checkbox problem - JavaScript Help


i have checkbox in form 1
and i use this
javascript code
function test(){
var mytext=document.form1.elements.length;
alert(mytext);}

html code



i cannot get any alert from this....which part is wrong

thx
Posted On: Wednesday 2nd of January 2013 12:37:49 AM Total Views:  297
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Urgent help needed !!!

I have a probelem - how to save information as a txt or js file and retrieve it later using only html or javascript .
VIEWS ON THIS POST

85

Posted on:

Monday 19th November 2012
View Replies!

Disappearing List Bug

Hi , Firstly I am using Scriptaculous to implement the sortable list but have looked there and not been able to find any reason for this to be occurring. I have a list of sortable items, there are 2 droppables enabled with the list, 1 to delete it and the other to place a "linked" item in another sortable list utilising a relational database. This all works fine except for this bug: When I add an item to the second list it goes there no problem and I can sort that list, but as soon as i try to do anything with the first list all the items in the list disappear. If I manually refresh the page then they all appear again as normal. Im using AJAX with my site as well and have a separate method and php call to insert from 1 list to another. Im not sure where I this bug might be, there is a lot of relevant code so I figured id ask before posting it incase someone can assist where the error might be or perhaps a bit more specific in terms of which code I need to post. Hope someone can help this has been driving me up the wall all night! :)
VIEWS ON THIS POST

40

Posted on:

Monday 19th November 2012
View Replies!

I need to create an online quiz.

Hi. I'm just a beginner in Javascript and I'd like some tips for making a quiz. Here's an example of one of my questions: Simplify the following: (c3)-2 = 1/c-6 c-6 1/c6 What I want after it is a submit button which will check the answer then display an alert box telling the user if they were wrong or right. When they close it another button should appear which is linked to an explanation page, and after they submit their answer they can't change it anymore, like the radio buttons have faded.
VIEWS ON THIS POST

63

Posted on:

Wednesday 21st November 2012
View Replies!

s is undefined

function getdigits(s) { return s.replace(/[^\d]/g, ""); } This will code will give "s is undefined" error. I don't understand why.. Here's the whole code, function getdigits(s) { return s.replace(/[^\d]/g, ""); } function phone_get_type(val) { return (getdigits(val).charAt(0) == '6' || getdigits(val).charAt(0) == '0') 1 : 0; } function vp(val, type) { /*! * type 0 = telephone * type 1 = cellphone * */ return (type == 0) /^[0-9]{3}[0-9]{4}$/.test(getdigits(val)) : /^(63|0)+[0-9]{10}$/.test(getdigits(val)); } function vcc(cc) { return /^(:4[0-9]{12}(:[0-9]{3})|5[1-5][0-9]{14}|6(:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(:0[0-5]|[68][0-9])[0-9]{11}|(:2131|1800|35\d{3})\d{11})$/.test(getdigits(cc)); } function fcc(cc) { var str_builder = new String(); for (var i = 0; i < cc.length; i++) { var c = cc.charAt(i); str_builder += (parseInt(c) % 1 == 0) c : ''; } return str_builder; } function luhn(cc) { var sum = 0; var i; for (i = cc.length - 2; i >= 0; i -= 2) { sum += Array (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) [parseInt (cc.charAt (i), 10)]; } for (i = cc.length - 1; i >= 0; i -= 2) { sum += parseInt (cc.charAt (i), 10); } return (sum % 10) == 0; } function fp(p, t) { if (t == 1 && p.charAt(0) == '6') { return '+'+ p; } else if (t == 0 && /^[0-9]{3}[0-9]{4}$/.test(p)) { return p.substring(0, 3) +'-'+ p.substring(3); } else { return p; } } Can someone help
VIEWS ON THIS POST

50

Posted on:

Wednesday 21st November 2012
View Replies!

XML document

I am a webmaster trying to implement an auto-content update system without using PHP, which is challenging for me because I use PHP, JAVA, C(and extentions), HTML usually. My current project requires me to not use PHP so I am using javascript and xml. I have the code written out but I am running into an error with Safari 4. If you can Please help me thanks in advance. Here's my code: var req; function loadXMLDoc(url) { var xmlDoc=null; if (window.ActiveXObject) {// code for IE xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } else if (document.implementation.createDocument) {// code for Mozilla, Firefox, Opera, etc. xmlDoc=document.implementation.createDocument("","",null); } else { alert('Your browser cannot handle this script'); } if (xmlDoc!=null) { xmlDoc.async=false; xmlDoc.load("test.xml"); document.write(""); var x=xmlDoc.getElementsByTagName("CD"); for (i=0;i
VIEWS ON THIS POST

41

Posted on:

Wednesday 21st November 2012
View Replies!

Javascript..calculating the cost of an event Help

I am working on a script that calculates the cost of an event, a wedding in this case... I need to create a string variable for the name of the event and numeric variables for the no. of guests, cost per guest and no. of limos. Also, create a boolean variables for live music, flowers and open bar. Assign the total event cost to another variable. Assume ea. limo cost $100.00. Use a conditional expression determine whether the live music variable is equal to true and if so add $500.00 to the cost of the event. same with the flowers only add $300.00 and open bar if true add $30.00 for each of the guests. There is more to this but this is what I have gotten so far, it obviously is not correct but I am not sure how to set it up correctly. Appreciate some help. The Wedding Event /* */ MOD EDIT: When posting code...USE CODE TAGS!!! This post has been edited by JackOfTrades: 02 February 2011 - 02:17 PM
VIEWS ON THIS POST

59

Posted on:

Thursday 22nd November 2012
View Replies!

How to write a program that ask for a price and a code

Can anyone provide any input on how I can get this to work. Its supposed to display the original price, the discount amount, the new discounted price or message if invalid code.
VIEWS ON THIS POST

79

Posted on:

Friday 23rd November 2012
View Replies!

JSON array problem

I have the following problem: when I try to access to the array in Big object I have 'Big is not defined' but when I try to access to the function in Low object I have no error!!!! WHY\t ...
VIEWS ON THIS POST

97

Posted on:

Friday 23rd November 2012
View Replies!

wrapping html paragraphs inside div

Hi! I am trying to wrap some html paragraphs inside a div element: 1st paragraph 2nd paragraph 3rd paragraph I want to have this when I select this text from an iframe with window.getSelection(): 1st paragraph 2nd paragraph 3rd paragraph and, in case I select 2 paragraphs and a half, the div woud end before : 1st paragraph 2nd paragraph 3rd paragraph
VIEWS ON THIS POST

63

Posted on:

Saturday 24th November 2012
View Replies!

Ext JS by Sencha

I was looking at using the Ext JS 4.1 (http://www.sencha.com/products/extjs/) , it promisses to enable developers to use the model-view-controller (MVC) architecture when building their app. can someone give me an example of how I can use the Ext JS 4 with MVC if I wanted to create a form using their code, it looks like I need to write a specific form code in JS for each form (with every element I want the form to have) I need, how is that MVC I'd like an option to build a form using PHP (to retreive data like- name fields and field type, etc..) to make my JS create that form on it's own, by getting data from php.. I expected to see some sort of generic functions with params.. what am I missing
VIEWS ON THIS POST

63

Posted on:

Saturday 24th November 2012
View Replies!

this.form undefined error on onSubmit()

I'm getting this.form undefined error message when I submit it. Do I miss anything
VIEWS ON THIS POST

79

Posted on:

Saturday 24th November 2012
View Replies!

help newbie here

What does this function means. contentEl : 'av',
VIEWS ON THIS POST

73

Posted on:

Saturday 24th November 2012
View Replies!

PHP datetime -> Javascript datetime for countdown

I'm trying to create a countdown timer that uses datetimes from a database. So far I have the endDate as a DateTime object. What I want to be able to do is pass this into javascript as a javascript DateTime, then find the difference between the endDate and Now, and countdown the days, hours, minutes, seconds until the endDate datetime then stop. So how do i get a PHP datetime object into javascript as a js datetime.
VIEWS ON THIS POST

61

Posted on:

Saturday 24th November 2012
View Replies!

ajaxSubmit and IE

, I have problem with submiting form in IE. This is the part of the code for submission. I am using jQuery validate and form plugins. On other browsers it submits. Tried ie7, ie8, ie9 and none of them submitted. (actually I tried on IE9, but in ie7, ie8 modes.) And they don't give me any error message. $("#register_form").validate({ errorClass: "reg_error", rules: rulesStep1, messages: messages, //onsubmit: false, //nevercia validatint formos submitinant submitHandler: function(form) { console.log('submitinsim su ajax'); //IE7 sito neuzlogina //$("#register_form").ajaxSubmit(); //$("#register_form").ajaxSubmit({ $(form).ajaxSubmit({ // $(this).ajaxSubmit({ success: function(data) { if (data == 'registration_successful') { //neaisku kodel su tokiais tagais ateina, bet dideles problemos kaip ir nera window.location.replace(project_url + current_language + 'authentication/sign-up.html'); } else { //alert(data); } //console.log(data); }//, //target: "#html" //test }); } }); Have you an idea why is that
VIEWS ON THIS POST

103

Posted on:

Saturday 24th November 2012
View Replies!

Refreshing only a single table of rich:tabPanel

m working on facelets and using a4j components. i have rich:tabPanel containing 11 panel. the second panel contains data which is generated dynamically according to the parameter(tablename) passed on the click on the tab.If the parameter at run time is passed as "BESTCUSTOMER", on the click of second tab,there is a query executed which get the data n binds with table.if the no. of records return is more than 1 ,the table is created dynamically and if the resultset contains only 1 record a dynamic panelgrid is created with 2 columns containing labels and outputText. When i run the application,the console shows the println's as required.I mean,according to the resultset mt application created table or grid,shows me the println traces in console but fails to render it.i want to refresh my second tab panel only on mouse move or can anybody give me some other solution for the task. Thankz in advance.
VIEWS ON THIS POST

62

Posted on:

Saturday 24th November 2012
View Replies!

Integrating JavaScript an HTML

This is the code I have so far, but something seems to be wrong with it. I don't know what though. Could someone point out what I'm doing wrong Fun with Phonics
VIEWS ON THIS POST

44

Posted on:

Saturday 24th November 2012
View Replies!

Problem with sending form

I am new with jQuery. I copied an open source code for sending a contact us form using jQuery. You can see the form at Website at the bottom right side yellow box. The input fields are as follows: Name, Email, Tel, Comments. This is my JS file the validates the form and sends to PHP file. 1. $(document).ready(function() { //if submit button is clicked $('#send_form').click(function () { function validEmail(str) { return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); } //Get the data from all the fields var name = $('input[name=contact_name]'); var email = $('input[name=contact_email]'); var phone = $('input[name=contact_tel]'); var comment = $('textarea[name=contact_message]'); //Simple validation to make sure user entered something //If error found, add hightlight class to the text field if (name.val()=='') { name.addClass('hightlight'); return false; } else name.removeClass('hightlight'); if ((email.val()=='') || (email.val().indexOf("@")==-1) || (email.val().indexOf(".")==-1)) { email.addClass('hightlight'); return false; } else email.removeClass('hightlight'); if (phone.val()=='') { phone.addClass('hightlight'); return false; } else phone.removeClass('hightlight'); if (comment.val()=='') { comment.addClass('hightlight'); return false; } else comment.removeClass('hightlight'); //organize the data properly var data = 'name=' + name.val() + '&email=' + email.val() + '&phone=' + phone.val() + '&comment=' + encodeURIComponent(comment.val()); //disabled all the text fields $('.text').attr('disabled','true'); //show the loading sign $('.loading').show(); //start the ajax $.ajax({ //this is the php file that processes the data and send mail url: "/includes/jquery/process_form.php", //GET method is used type: "POST", //pass the data data: data, //Do not cache the page cache: false, //success success: function (html) { //if process_form.php returned 1/true (send mail success) if (html==1) { //hide the form $('#contact_form').fadeOut('slow'); //show the success message $('#contact_done').fadeIn('slow'); //if process_form.php returned 0/false (send mail failed) } else { alert('111Sorry, unexpected error. Please try again later.'); } } }); //cancel the submit button default behaviours return false; }); }); This is my PHP form that handles the form itself: 1. \t' . $name . ' \t\t' . $email . ' \t' . $phone . ' \t\t' . nl2br($comment) . ' '; //send the mail $result = mymailer($from, $subject, $message); if ($result) return 1; else return 0; //if POST was used, display the message straight away if ($_POST) { if ($result) echo 'Thank you! We have received your message.'; else echo '222Sorry, unexpected error. Please try again later'; //else if GET was used, return the boolean value so that //ajax script can react accordingly //1 means success, 0 means failed } else { echo $result; } //if the errors array has values } else { //display the errors message for ($i=0; $i I don't understand why it is not working. It is not sending me an email.
VIEWS ON THIS POST

74

Posted on:

Saturday 24th November 2012
View Replies!

Disable "Enter" in radio button area in?

I have a web form. I want the "enter" key disabled from sending the form so users have to SUBMIT in order to send form. Have the following entered in the head: function stopRKey(evt) { var evt = (evt) evt : ((event) event : null); var node = (evt.target) evt.target : ((evt.srcElement) evt.srcElement : null); if ((evt.keyCode == 13) && (node.type=="text")) {return false;} } document.onkeypress = stopRKey; It works great in the "text" form area which is in a table format. Sample: First Name:  Last Name:  When I get to the radio button area it doesn't work. It is NOT in a table format. Here's a sample of the radio button area: 1. The fundamental building blocks of matter are atoms and _________. a. mass b. protons c. molecules d. neutrons Any help would be greatly appreciated., Serendipity, The easiest way, in my experience, is not to use a submit button. Instead, use a regular . The script gives the necessary submit action. Thus, the only way to submit the form should be for the user to click the "Submit" button (or to hit enter if/when it has focus). I used to be sure that this technique was universally true, but you should test the latest crop of browsers to make sure. I could be out of date. The slight downside is that (should you need it) will now not intercept the submission, but the workaround is also simple; modify the "Submit" button's onclick"this.form.submit();" to make submission conditional or whatever you would otherwise put in the form's onsubmit . If it gets complex, then write/call a function. Here is a demo which you can use to do some testing: Airshow :: Untitled form { margin-top:20px; padding:12px; width:150px ; border:1px solid #999; } function writeInputText(){ document.f1.i1.value = 'ABCDEF'; document.f2.i1.value = 'ABCDEF'; } onload = function(){ setTimeout("writeInputText()", 1000); } Airshow
VIEWS ON THIS POST

47

Posted on:

Saturday 24th November 2012
View Replies!

ajax code help

hi let me explain what i want I have four pages.two html, one js and one php. First page is loginTab.html. There is a tab called "Tab One" when user clicks on it there is a script inside this html page which calls function and loads an external login.html form using ajax. in login.html there is a form and include external js code for ajax functions. what it does is when the user enters email and password and clicks submit then it triggers another ajax function which send a query to php file and compare those variables there with mysql db and returns the message to a div which is in login.html. the problem here is when i enter email and password and clicks on submit button it does not display anything. How this problem can be solved.i am providing all of my code below loginTab.html Untitled Document window.onload = init; var xhr = false; function init() { if(window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { if(window.ActiveXObject) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { } } } } function tabOne() { if(xhr) { xhr.onreadystatechange = showTabOne; xhr.open("GET","login.html", true); xhr.send(null); } } function showTabOne() { if(xhr.readyState == 4) { if(xhr.status == 200) { var outMsg = xhr.responseText; } else { var outMsg = "Sorry Error."; } document.getElementById("message").innerHTML = outMsg; } } .tabs { width: 100px; height: 25px; border: 1px solid black; cursor: pointer; } Tab One login.html Untitled Document Email: password: login.js window.onload = init; var xhr = false; function init() { if(window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { if(window.ActiveXObject) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { } } } } function ajaxFunction() { var email = document.getElementById('email').value; var password = document.getElementById('password').value; var queryString = "email=" + email + "&password=" + password; if(xhr) { xhr.onreadystatechange = show; xhr.open("GET","login.php" + queryString,true); xhr.send(null); } } function show() { if(xhr.readyState == 4) { if(xhr.status == 200) { var outMsg = xhr.responseText; } else { var outMsg = "Sorry Problem"; } document.getElementById("message").innerHTML = outMsg; } } login.php Untitled Document
VIEWS ON THIS POST

74

Posted on:

Saturday 24th November 2012
View Replies!

customized right-click menu based on id

, I'm trying to customize the popup menu based on which table I right-click on. I have disabled the right-click function on the page except for the tables. I did this on purpose. This web page will be called from a python software, using the IE activeX, so no worries here about the browser compatibility. I just don't know how to get the variable from showmenuie5(getid) and transfer it to the menu Thank you very much for your help. - Dan // no right-click function clickIE() { if (document.all) { }} function clickNS(e) { if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {}}} if (document.layers) { document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS; } else { document.onmouseup=clickNS;document.oncontextmenu=clickIE; } document.oncontextmenu=new Function("return false") // popup menu var menuskin = "skin1"; var display_url = 0; function showmenuie5(getid) { var rowid = getid var rightedge = document.body.clientWidth-event.clientX; var bottomedge = document.body.clientHeight-event.clientY; if (rightedge < ie5menu.offsetWidth) ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth; else ie5menu.style.left = document.body.scrollLeft + event.clientX; if (bottomedge < ie5menu.offsetHeight) ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight; else ie5menu.style.top = document.body.scrollTop + event.clientY; ie5menu.style.visibility = "visible"; return false; } function hidemenuie5() { ie5menu.style.visibility = "hidden"; } function highlightie5() { if (event.srcElement.className == "menuitems") { event.srcElement.style.backgroundColor = "highlight"; event.srcElement.style.color = "white"; if (display_url) window.status = event.srcElement.url; } } function lowlightie5() { if (event.srcElement.className == "menuitems") { event.srcElement.style.backgroundColor = ""; event.srcElement.style.color = "black"; window.status = ""; } } function jumptoie5() { if (event.srcElement.className == "menuitems") { if (event.srcElement.getAttribute("target") != null) window.open(event.srcElement.url, event.srcElement.getAttribute("target")); else window.location = event.srcElement.url; } } Country page Add to favorite if (document.all && window.print) { ie5menu.className = menuskin; document.body.onclick = hidemenuie5; } Row 1 - Canada Row 2 - USA Row 3 - New Zealand
VIEWS ON THIS POST

87

Posted on:

Saturday 24th November 2012
View Replies!

New to javaScript and need help, please!

, I'm learning JavaScript programming and I have a test to do. Will it be possible for someone to check what I've already written and let me know if I'm on the right track In green are the questions asked and in red are my answers. I also put the original code in black. Thank you in advance for your time and guidance. Open M150_TMA05_2009B_Q1_task1.html in the text editor and read through the code to see how Math.random() is used. Run the program, observing the output in the alert dialogue. When you close the alert dialogue box a Display Random Number button is visible in the browser window: ignore this for now. M150 TMA 5 : Programming : Task 1 - Testing Math.random() //generate a random number greater than or equal to 0.0 and less than 1.0 //and display it in an alert dialogue window.alert("Random number returned is: " + Math.random()); A test of the random number functions Edit M150_TMA05_2009B_Q1_task1.html so that the alert dialogue box will display numbers greater than or equal to 0.0 and less than 50.0. Remember to make appropriate changes to the code comment. M150 TMA 5 : Programming : Task 1 - Testing Math.random() //generate a random number greater than or equal to 0.0 and less than 50.00 //and display it in an alert dialogue window.alert("Random number returned is: " + Math.random()*50); A test of the random number functions Edit M150_TMA05_2009B_Q1_task1.html replacing the existing JavaScript with the function getRoundedRandomNumber(aNumber). This function should return whole numbers between 0 and aNumber, using Math.round() as outlined above. Write a comment to document what this function does, using an extended comment (that is, one between /* and */). Also provide appropriate single-line comments (the ones starting with //) in the code, describing how it works. Paste a copy of the getRoundedRandomNumber() function into your Solution Document. M150 TMA 5 : Programming : Task 1 - Testing Math.random() /*Generate a random number greater than equal to 0.0 and less than aNumber. Create a function to round the random number generated and display it using the event handler Onclick.*/ var aNumber = parseFloat((window.alert("hello" + Math.random()*50))) ; //create the function getRoundedRandomNumber( ) to be called when Onclick is pressed function getRoundedRandomNumber(aNumber) // round the number generated by the random { var aRoundedNumber = Math.round(Math.random() * (aNumber)) ; // show the result of the number return aRoundedNumber ; } A test of the random number functions
VIEWS ON THIS POST

87

Posted on:

Saturday 24th November 2012
View Replies!

Using Java have a table "hidden" onload?

I have what I hope is a simple question. I found a js that does exactly what I want, except that I want the table 'closed' when the page is loaded, and opened when the +/- is clicked. I'd like this in Java. (assuming that non-java users would see the table 'open/show') Hope someone can help.
VIEWS ON THIS POST

68

Posted on:

Saturday 24th November 2012
View Replies!

Opening a Template in NVU to edit

Im working in web designing module. My one of the html file has several template samples as well as a link like "Edit this Template". When i click this link, that corresponding template should open with the designing software such as dreamweaver, NVU etc.,( In my case im using NVU) i.e., that selected template should open with NVU application to edit.. How is this possible.. Im blank. Please give me some ideas or sample codes or reference URL'S.... Thank You in advance...
VIEWS ON THIS POST

72

Posted on:

Saturday 24th November 2012
View Replies!

Center Div in Browser

A requirement for the project I am currently working on is that when various links on a page are clicked that the appropriate "layer" (i.e. div) will be displayed centered in the browser. I have tried using various javascript solutions and they center some div's and not others. Does anyone have an example of a way to show and hide a div that is centered in the browser no matter where the div is located in the html Any html/css and javascript code examples greatly appreciated!
VIEWS ON THIS POST

257

Posted on:

Saturday 24th November 2012
View Replies!

Javascript with Ajax question

, I am making a website where I have a panel of colors to choose from and it allows the user to click on a layer on the page and then click on the color they wish to change that layer to. Everything works fine and the color changes, BUT I need to be able to save the color changes. So basically I need a way to insert the value of the color variable into my MySQL database. People have told me that this can be accomplished using Ajax since I am using javascript to make the color changes, but I cannot seem to figure out how to do this. Here is an example of what I'm talking about. My function which changes the color of a certain layer is like this: function color(strColor) { var i; for (i=0;i
VIEWS ON THIS POST

85

Posted on:

Sunday 25th November 2012
View Replies!

Can this be done with Javascript? Microcontrollers/TCP IP

I'm very new to Javascript so maybe my question could be stupid. I'm playing with microcontrollers and a TCP/IP component. This means that I can control electronics via TCP/IP, UDP and so on. But, my problem is on the ...
VIEWS ON THIS POST

69

Posted on:

Sunday 25th November 2012
View Replies!

Animation

How would I animate a something across a screen
VIEWS ON THIS POST

76

Posted on:

Monday 26th November 2012
View Replies!

JavaScripts onchange event handler

List 2 HTML elements that can be associated with the Javascript event handler on change
VIEWS ON THIS POST

93

Posted on:

Monday 26th November 2012
View Replies!

random background images

So, I have a client that wants a new background image every time page is reloaded. I thought I have to script and thought I had it working but when I applied it to all my pages from a template I made in dreamweaver it doesn't work. It only works on the template. Any ideas....\t Oh, FYI I have no background css so things won't get confused. See code below.
VIEWS ON THIS POST

88

Posted on:

Monday 26th November 2012
View Replies!

passing selected radio button value from js to java

Hi all, I have two radio button yes,no in a.jsp. var IncludeCharges = document.getElementById("IncludeCharges_no").value; If i select yes i need to pass 1 to the java file and in case of no i need to pass 0. but when i retrive the radio button value using int Includecharges = Integer.parseInt(request.getParameter("IncludeCharges_yes"); It shows undefined... How could i get the value
VIEWS ON THIS POST

245

Posted on:

Monday 26th November 2012
View Replies!

CSS Accordion Menu - Javascript help needed

, I have put together an accordion menu using css, html (ul, li tags) and javascript. I'd like the arrows on the collapsible menus should change state depending on if they're open or not. The triangle turner should point right when the content is closed and can be opened. The triangle turner should point up when the content is open and can be closed. But I'm not sure how to replace this arrow image css using javascript. css to open menu: level01_top_link_subnav_open css to close menu: level01_top_link_subnav_close I have attached the menu page and its associated files (see the zip file). You can view the menu here: http://praky.com/demo/gui-prototype/accordion/navmenu_accordion.html I'd appreciate if someone can help me with this. Many
VIEWS ON THIS POST

104

Posted on:

Monday 26th November 2012
View Replies!

Jquery validating radio button - JavaScript Help

I am trying to validate radio buttons for gender using Jquery, but have no clue as to how I go about doing it, the different ways I've tried do not seem to work> anybody have any help.I have included the form part for the gender radio buttons. Gender /> Female
VIEWS ON THIS POST

77

Posted on:

Tuesday 27th November 2012
View Replies!

Extending a jQuery plugin - JavaScript Help

I have a default plugin(function($) { $.lsc = function (json) { $.lsc.vars = json; if (json['toolbar']) $.lsc.toolbar (); } //Create essential functions $.extend ($.lsc, { init: function () { //some code }, }); });This appears to work fineNow when my whole project is in debug mode, a seperate javascript file is loaded with the following(function($) { //Create essential functions $.extend ($.lsc, { toolbar: function () { alert(1); }, }); }); But I get the following error: $.lsc.toolbar is not a functionHow can I create a plugin and extend in a seperate file with additional functions when my project is in debug modeI have never written a jQuery plugin before and struggling to get my head round it
VIEWS ON THIS POST

102

Posted on:

Tuesday 27th November 2012
View Replies!

Re Parse Div In Page

Hi I have this div and I AJAX html into it, the problem is that the AJAXed html does not interact correctly with the rest of the page. I think i need to re parse the div, but not sure... Does anyone know how to have it parse the div or a better way to fix this This is the div that the html is AJAXed into:
VIEWS ON THIS POST

77

Posted on:

Thursday 29th November 2012
View Replies!

Re: open and close a window

sheldonlg wrote on 11 jun 2008 in comp.lang.javascript : > Does anyone know how to open a window and have it close by itself You > may ask why, but here it is. I want to have it open (a ...
VIEWS ON THIS POST

88

Posted on:

Friday 30th November 2012
View Replies!

Button with onClick inside Form (with Submit Button)

In Internet Explorer, I get the error message "Object Expected" when we click on the button ("Text") when I click in Internet Explorer. In Mozilla, clicking the button invokes the Action (recordurlvote.scgi) .. (Obviously, this is a simplified version of ...
VIEWS ON THIS POST

78

Posted on:

Friday 30th November 2012
View Replies!

Cuffs - code and effect comment?

, and js -dates.htm, and some Easter pages, now include . function Cuffs() { var ThisPage, ThisSite, J, DLJ, HREF ThisPage = location.href.replace(/#.*/, "") ThisSite = location.protocol + "//" + location.hostname + "/" for (J in document.links) ...
VIEWS ON THIS POST

356

Posted on:

Friday 30th November 2012
View Replies!

Calling a Function On load of a HTML Jquery Mobile?

I tried $('#page18').bind("load",function() { alert("total Type") ; }); and also i tried doing this $('#page18').ready( function() { alert("total Type") I want to call a function on Load of a Html5 Jquery Mobile page. I have various Div with Each of them has Id.Now with navigation when I reach on i want to cal a function ... }); But cant seem to fig it out. can anyone help me with this
VIEWS ON THIS POST

99

Posted on:

Friday 30th November 2012
View Replies!

newbie: how to compare form input to variable value?

, In my form validation, I'm testing a form input field to see if it contains the same number as a variable contains. if the variable is called "match1", and my user text field is named "guess1" I'm trying to ...
VIEWS ON THIS POST

93

Posted on:

Friday 30th November 2012
View Replies!

SkimpyGimpy PNG canvas w/ Javascript mouse tracking

ANN: SkimpyGimpy PNG canvas has Javascript mouse tracking The SkimpyGimpy PNG image canvas now can generate Javascript data structures which allow HTML pages to intelligently respond to mouse events over the image. Please read about the SkimpyGimpy Canvas and look ...
VIEWS ON THIS POST

135

Posted on:

Friday 30th November 2012
View Replies!

JavaScript "objects" to extend HTML Elements

Hi! I create HTML pages on the server side. I want to extend DIV elements with more information. E.g.:
Now I want Joe to have an age for example and access it using: $('joe').age = 20; Doing ...

VIEWS ON THIS POST

113

Posted on:

Friday 30th November 2012
View Replies!

javascript function to display message

So i need to write or modify javascript code i think, for what i want to do. The web page im developing displays a table with two arrows beneath, one to go show next and one to show previous. I need the show previous arrow to display an alert box if the user selects it when the page is first loaded (they cant show previous because nothing has been shown yet). Again similar for the show next arrow, if the user selects it when the last name is displayed in the table then it should show a message saying no more names. I've no idea how to do this and it sounds like it should be easy. The code i have is: COM301 var studentNames = new Array ("Jack Dee", "Ruby Wax", "Billy Connolly", "Miranda Hart", "Al Murray"); var regNumbers = new Array ("10001", "10002", "10003", "10004", "10005"); var currentStudent = -1; function showNext() { currentStudent=currentStudent+1; document.getElementById("nameHolder").innerHTML=studentNames[currentStudent]; document.getElementById("regNumberHolder").innerHTML=regNumbers[currentStudent]; } function showPrevious() { currentStudent=currentStudent-1; document.getElementById("nameHolder").innerHTML=studentNames[currentStudent]; document.getElementById("regNumberHolder").innerHTML=regNumbers[currentStudent]; } COM301 Assessment 4 - Event-driven programming Useful Links Click here for Google Click here for BBC StudentName Registration Number A good place for a footer This is not homework or anything. I am a university student and trying to get my skills up to scratch before I start placement.
VIEWS ON THIS POST

104

Posted on:

Sunday 2nd December 2012
View Replies!

Writing JavaScript to HTML page

I want to output some Javascript onto a HTML page. I am trying to put the date that the page was last modified onto the bottom of the HTML page, using the document property 'lastmodified'. Currently my code looks like this: This page was last modified on: document.write(document.lastModified) I want to move this text to the right hand side of the page and I thought I could do that using a span class, however, it seems that this doesn't work. I suspect that I have to use 'getElementById()', if so, could someone explain to me how this works Thank for your help.
VIEWS ON THIS POST

81

Posted on:

Sunday 23rd December 2012
View Replies!

Who manages Javascript?

You know how php, java, mysql, they all have a project page and some sort of foundation that backs. Well who backs javascript I can never seem to find an official js site, one with all the classes/methods/properties, you can find what your looking for but i was wondering if there is some sort of foundation site to it.
VIEWS ON THIS POST

86

Posted on:

Sunday 23rd December 2012
View Replies!

Basic Javascript Rollover

For some reason I cant get my rollovers to work on my web design here's the html http://halffull.free...rash/index.html THE Javascript window.onload = rolloverInit; function rolloverInit() { for (var i=0; i
VIEWS ON THIS POST

124

Posted on:

Monday 24th December 2012
View Replies!

javascript: void(0)

java script: void(0) every time i click on some page this error comes in !!! and the site never opens !! help please !!!!
VIEWS ON THIS POST

93

Posted on:

Monday 24th December 2012
View Replies!

String replacement of file.name - JavaScript Help

Greetings,I am barely literate in Javascript, but I have done my best to try figuring this out on my own. I am playing with a Drag & Drop uploading script for HTML 5 that i found here: http://www.sitepoint...-drag-and-drop/I have been able to get the script 95% set up to allow uploads, but it has a problem parsing when it comes to dealing with white space. If an uploaded file has spaces in the name, the name output stops at the first whitespace.As I said above, i have gone through many blogs and posts in the past several hours trying to figure the best way to do a string replace, but my ignorance of JS limits me on how to find the proper place for this. However, I think it has to belong in here: // Output link Output( "" + file.name + "" );/* filedrag.js - HTML5 File Drag & Drop demonstration Featured on SitePoint.com Developed by Craig Buckler (@craigbuckler) of OptimalWorks.net */ (function() { // getElementById function $id(id) { return document.getElementById(id); } // output information function Output(msg) { var m = $id("messages"); m.innerHTML = msg + m.innerHTML; } // file drag hover function FileDragHover(e) { e.stopPropagation(); e.preventDefault(); e.target.className = (e.type == "dragover" "hover" : ""); } // file selection function FileSelectHandler(e) { // cancel event and hover styling FileDragHover(e); // fetch FileList object var files = e.target.files || e.dataTransfer.files; // process all File objects for (var i = 0, f; f = files[i]; i++) { ParseFile(f); UploadFile(f); } } // output file information function ParseFile(file) {} // upload .Torrent files function UploadFile(file) { // following line is not necessary: prevents running on SitePoint servers if (location.host.indexOf("sitepointstatic") >= 0) return var xhr = new XMLHttpRequest(); if (xhr.upload && file.type == "application/x-bittorrent" && file.size
VIEWS ON THIS POST

150

Posted on:

Friday 28th December 2012
View Replies!

simple jquery conditional response-to-comment form display - JavaScript Help

I am looking to compare the data-commentid attribute process in javascript after user slideToglle function. I want to compare that value attribute in each interaction with $id variable within the php. if $id = commentid data attribute in the span tag then display the response. I am not sure whether to do the comparison in php or javascript. an example or idea is if(after slideToggle, write a response, submit the form with the response then compare $id == $idc) that would be the sequence. if $id == $idc then display the response and only then.Any idea code I have so far is as below. ' . $ufirstname . ' • ' . $message_date . ' hi how you doing today id=101
VIEWS ON THIS POST

108

Posted on:

Friday 28th December 2012
View Replies!

set if statement for mousedown - JavaScript Help

,My question is, is it possible to create an if statement for div.onmousedown that will then excute document.onmousemove call function. var div = document.getElementById('div'); document.onmousedown = eventHandler(); function eventHandler(){ if(div.onmousedown){ document.onmousemove = moveFunction(); } } The reason I ask this is that i have a script that moves a div in a certain area and need the div to move even if the mouse is not inside it. This mouse down function is not the only one so i need something that can work with multiple mouse functions depending on wat one wat clicked etc
VIEWS ON THIS POST

90

Posted on:

Tuesday 1st January 2013
View Replies!

auto show current li link - JavaScript Help

hi,i have the following javascript code: function initMenu() { $('#menu ul').hide(); //what code to put here and show the current_link; $('#menu ul:first').show(); $('#menu li a').click( function() { var checkElement = $(this).next(); if((checkElement.is('ul')) && (checkElement.is(':visible'))) { return false; } if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { $('#menu ul:visible').slideUp('normal'); checkElement.slideDown('normal'); return false; } } ); } $(document).ready(function() { initMenu(); }); what i want to do is to show the current link without having to click on the ul link, you can see it online at the right menu at : www.tigicy.com/products.php
VIEWS ON THIS POST

56

Posted on:

Wednesday 2nd January 2013
View Replies!