Validate Checkbox without a form Please Help - JavaScript Help


I want to set up a Javascript Function with a onclick without the use of a form.

Heres a simple Checkbox:


Check the button is clicked.




Submit This

I want to add a function to see if checkbox is checked upon clicking the link:


function meClick(){
if(document.checker.checked == true){
alert("Hooray... checkbox is clicked");
}else{
alert("Nah... its not working");
}
}


But this is not working... please help... been driving me mad for hours!!!!
Posted On: Friday 28th of December 2012 04:30:59 AM Total Views:  120
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Pass id of anchor to use in function: JQUERY

, I was wondering if someone could help me with this. I want to, when an anchor link is clicked, the id of the link is grabbed by jquery then passed to a function. The id is would be the same as the id of the div that is used for the function (highlight). If someone could tell me or point me in the right direction. Here is what I have right now. $(function(){ $('#mainq a').click(function(){ var id = this.id(); $('this.id').highlightFade({speed:2000}); }); }); The HTML is like this (its for FAQ section): QUESTIONS SECTION: Payment and Billing. What is water What is copper Payment and Billing. What is water What is copper ANSWERS HERE: What is Water Water is H2O. What is Copper Copper is cu. The code is a little messy but I am just testing right now. So if someone clicks on #aq1 link the id "aq1" is grabbed and used for the highlightFade function. It would highlight the div with id "aq1".
VIEWS ON THIS POST

72

Posted on:

Monday 19th November 2012
View Replies!

A Javascript Project - Building a library

Hi ! This is Parth. I have been learning Javascript for a few months now and wanted to get in some action. I mean like I want to write a javascript library (of course, can't event think about likes of jQuery, Dojo, Prototype etc.), but i've realised it's no quite easy. So i need help of some experienced (and others too) to make it at least an average library. Please contact me soon, so we can share some ideas.
VIEWS ON THIS POST

102

Posted on:

Wednesday 21st 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

82

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

155

Posted on:

Saturday 24th November 2012
View Replies!

help newbie here

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

141

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

86

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

185

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

82

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

57

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

132

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

69

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

103

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

130

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

153

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

115

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

126

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

363

Posted on:

Saturday 24th November 2012
View Replies!

Javascript Math

. I seem to be having trouble with the doMath() section of my code. I was wondering if you can help me out... Package Plans function doMath() { var one = eval(document.theForm.elements[0].value); var two = eval(document.theForm.elements[1].value); var outp = ""; var outps = ""; { ans = one*two; ansq = (one*two)*12; outp = " " + "$" + ans.toFixed(2) + "/Month"; outps = " " + "$" + ansq.toFixed(2) + "/Year"; } document.getElementById('outtab').innerHTML = outp; document.getElementById('outtab1').innerHTML = outps; } function calcPackage(){ var text = document.getElementById('price'); var rad=document.one.gb; for(var i=0;i
VIEWS ON THIS POST

66

Posted on:

Sunday 25th November 2012
View Replies!

Send Json object through ajax

Im having difficulty getting my form contents to send to my php page using ajax, jquery and json. The results just doesnt want to show. My javascript, where I create the JSON object and try to send it through to the php page: var JSONobj; var JSONstr; function createJSON(){ JSONobj = { firstname : $('#firstname').val(), surname : $('#surname').val(), age : $('#age').val(), email : $('#email').val() }; JSONstr = JSON.stringify(JSONobj); } $(document).ready(function() { $('#submit').click(function(e){ e.preventDefault(); createJSON(); $.post("save.php", {data:JSONstr}, function(result){ alert(result);}, "json"); }); }); The php page: What should happen is the firstname should be alerted. But the alert box doesnt even show and I find no errors using firebug...
VIEWS ON THIS POST

141

Posted on:

Sunday 25th November 2012
View Replies!

jQuery - unbind hyperlink click

Hi im messing around with some jQuery and want to disable a link whilst it performs a ajax post (its adding/fetching somthing from a database) and i want to disable the link so it cant be multiclickd. See Page ive tried using $("#seepages").unbind('click'); but that dosnt work! =( how ever when i tried this $("#seepages").unbind('click'); $("#seepages").attr("id", "disabled"); that works! but using either one of them by them self doesn't - work but why any advice/tips would be useful! thanks in advance =) edit: i should also have said that i have to use: $("#disabled").attr("id", "seepages"); $("#disabled").bind('click'); to enable it again
VIEWS ON THIS POST

70

Posted on:

Sunday 25th 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

120

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

92

Posted on:

Sunday 25th November 2012
View Replies!

anchor tag to submit a form to server not working

RESOLVED i have a form with information in it, but to make it cleaner, i want to use an anchor tag to submit. the way i have it now is as follows: function submitter(formNum){ document.getElementById('form'+formNum).submit(); } send it There will be X number of these forms, so i was going to iterate through, and make em all form1, form2, form3, etc... and then pass in the number in the function which will submit. It doesnt seem to work. Alternate plans were do change the send it which also didnt seem to work. It needs to run on IE7, but that shouldnt be a problem. This post has been edited by fallenreaper: 20 October 2011 - 04:56 AM
VIEWS ON THIS POST

147

Posted on:

Monday 26th November 2012
View Replies!

JSON value "undefined" in jQuery (AJAX request?

I'm having an issue accessing values of an AJAX response from a PHP script. I'm using an alert() for debugging purposes to show the data and it shows "undefined" as things are done below. Here's what I have so far. jQuery AJAX request: $(".edit").click(function(event) { var id = $(this).parents("tr").attr("id"); alert(id); //Shows the correct id that matches the DB entry $.ajax({ type: 'POST', url: 'editevent.php', data: "eventID=" + id, success: function(data) { alert(data); //currently shows [object Object] }, dataType: 'json' }); }); editevent.php:
VIEWS ON THIS POST

237

Posted on:

Monday 26th November 2012
View Replies!

Animation

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

111

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

135

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

130

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

359

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

170

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

116

Posted on:

Tuesday 27th November 2012
View Replies!

Javascript Chrome vs Firefox! - JavaScript Help

Alright I am doing a project and I have ran into a particular issue with Firefox not wanting to properly work this particular bit of the script!I am populating a second select menu depending on the selected value of the first select menu. var yearselect = document.getElementById("schoolyear"); var year = yearselect.options[yearselect.selectedIndex].value; var newselect = document.getElementById("coursecode"); var a; for ( a = newselect.length - 1; a >= 0; a-- ) { newselect.remove(a); } if ( year == 100 ) { var course = new Array(); course [0] = "Literature" ; course [1] = "Foreign Literature" ; var code; for (var i = 0; i < course.length; ++i ) { code = "10" + i ; newselect.add(code, course[i]); newselect.options[newselect.options.length] = new Option(course[i], code, false, false); } } I have it set to do the function onblur, which works perfectly changing through the first menu for all of them in Chrome. Unfortunately Firefox doesn't want to put the data in when I go back to the first option in the first menu from any other option. It will render it correctly for the 2nd, 3rd, and 4th options, but the second select menu is blank when I click off of the first menu using the first option.Any ideas
VIEWS ON THIS POST

101

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

196

Posted on:

Tuesday 27th November 2012
View Replies!

IE strikes again... JQuery, runs as expected in FF, Opera, Chrome. - JavaScript Help

But in IE it does absolutely NOTHING, I get an ActiveX warning, accept the content yet it still does nothing. $(document).ready( function() { $("a.menu").hover( function() { $(this).animate( { padding: "8px 175px 0 0", backgroundPosition: "0px center" }, 1000, function() { //done! } ); } , function() { $(this).animate( { padding: "8px 0 0 175px", backgroundPosition: "175px center" }, 1000, function() { //done! } ); } ); } ); Can anyone spot where I'm going wrong and point it out to me First time I've tried JQuery (I know, way behind the times but I'm lazy...
VIEWS ON THIS POST

71

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

113

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

147

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

109

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

451

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

144

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

148

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

240

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

182

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

129

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

143

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

133

Posted on:

Sunday 23rd December 2012
View Replies!

undefined functions?

using function validateForm(thisform) {code} I get an undefined function error. I went by the book on this one and have no idea what else to do, please help!
VIEWS ON THIS POST

55

Posted on:

Monday 24th 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

182

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

123

Posted on:

Monday 24th December 2012
View Replies!

Script include stopping next button working - JavaScript Help

Hi i am trying to develop my registration page it is a combination of multistep (tabs) with real time validation which is sort of working ok, it validates on entry which is really good, however when i include the scriptJavascript / DHTML / AJAX Syntax (Toggle Plain Text) which is for the form validation, for some reason the next button for the tabs do not work, when i take it out the next buttons work but the form validation does not.Any ideas the code for the next button is at the bottom of the code below, the code for the validation is in a seperate file and is pretty big, so ask if you want me to include it
VIEWS ON THIS POST

106

Posted on:

Friday 28th 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

185

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

140

Posted on:

Friday 28th December 2012
View Replies!