JavaScript - Javascript:void(0) Issues Ie
I am having trouble with javascript:void(0) when using IE
The website URL is: http://gerritygroup.com.s136675.grid...wn-center.html When you click on the map link it should open up the map on the same page but instead it shows an empty white box. For whatever reason it wont open the imbed map code when using javascript:void(0) in my a tag. This site was built in MODX and seems to be working fine in all other browsers. Firefox, Safari and Chrome. Please let me know if you have any other ideas that will get this map opening again in IE. Similar Tutorialsquestion is Code: href="javascript:void(null);" the same as Code: href="javascript:void(0);" if not whats the preferred or standardized use to avoid conflict.. A can't vote and see poll's result... http://tylko-kibice.pl/Administrator/polls/256/ Anybody knows a solution? When I go to a website and try to submit an online email to them I get as far as NEXT, to go forward, I receive this error message. JavaScript: Void ( ) Can you help I have a webpage that display a Reporting Services report viewer page inside an iFrame. In the report that displays there is a link to a product image that needs to pop-up in a new window. Reporting Services will only allow me access to the url value of the link so we have been using the code below to open the new window. Thing is the code works fine when the parent iFrame is in the same site, OR another IIS site on the same server. It will not work when the iFrame page and the page with the link are on different servers (which with my luck is the setup I need to have for business reasons...). I've stripped this down to an empty iFrame holding a page with just the link and the behavior stays the same. Is there something in the syntax below that is causing the issue, or is there another way to go about popingthe link up in a new window using only the url? Thanks, Chris Code: <a tabindex="7" href="javascript:void(window.open('http://webreporting.domain.com:81/images/PIE0522.jpg', '_blank','location=no,toolbar=no,left=100,top=100,height=200,width=200'))" style="text-decoration:none;color:Black" TARGET="_top">PIE0522</a> I read somewhere (I think from Douglas Crockford) that void is a completely useless operator. What is its actual purpose? Is there anything it's good for? I see lots of javascript:void(0) hyperlinks all over the place. From what I gather, it just disables the link's default behavior...buy why not just make the href="#" or return false from an onClick handler? Can anyone enlighten me? When I enter the data into my form then submit it, it is supposed to be inserted into my MySql database but I get the following error: "Unable to save data to database: Incorrect date value: '3-31-2001' for column 'sent_date' at row 1" The sent_date field is the first date field the user types in. The TYPE for this field in the MySql database is set to DATE. Any ideas what is going on? I think the problem is in my javascript but can't find the problem... _________________________________________________________ Below is the javascript code _________________________________________________________ <script type="text/javascript"> var valid; function dcheck(form) { var a = form.assgn_date.value; var s = form.sent_date.value; var i = form.interv_date.value; var dr = form.due_rev.value var su = form.due_suspo var clk = form.due_clerk var att = form.due_attny var jdg = form.due_judge var assn = new Date(a); var sent = new Date(s); var intv = new Date(i); var due_rev = new Date(dr); var due_suspo = new Date(su); var due_clerk = new Date(clk); var due_attny = new Date(att); var due_judge = new Date(jdg); if (isNaN(sent)) { sent = new Date(assn.getFullYear(),assn.getMonth(),assn.getDate()-7); } if (isNaN(due_rev)) { due_rev = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-42); } if (isNaN(due_suspo)) { due_suspo = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-40); } if (isNaN(due_clerk)) { due_clerk = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-38); } if (isNaN(due_attny)) { due_attny = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-36); } if (isNaN(due_judge)) { due_judge = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-7); } form.sent_date.value = (sent.getMonth()+1) + "-" + sent.getDate() + "-" + sent.getFullYear(); form.due_rev.value = (due_rev.getMonth()+1) + "-" + due_rev.getDate() + "-" + due_rev.getFullYear(); form.due_suspo.value = (due_suspo.getMonth()+1) + "-" + due_suspo.getDate() + "-" + due_suspo.getFullYear(); form.due_clerk.value = (due_clerk.getMonth()+1) + "-" + due_clerk.getDate() + "-" + due_clerk.getFullYear(); form.due_attny.value = (due_attny.getMonth()+1) + "-" + due_attny.getDate() + "-" + due_attny.getFullYear(); form.due_judge.value = (due_judge.getMonth()+1) + "-" + due_judge.getDate() + "-" + due_judge.getFullYear(); return true; } </script> Hello all, first time poster. I recently found this site as I was searching for topics to possibly help me fix my issue. So, without further ado: I've been working on a website for a grass roots Senate hopeful in Colorado, and I was asked to create a bit of interactivity into the site. Now, I'm well versed in XHTML/CSS, but I'm still a fledgling JavaScript writer. I was able to create a set of code that would allow for this to happen: 1.) A person would click on a link in a list of questions. 2.) That question's text would appear in a box on the right. 3.) Below the text from #2, a YouTube video would show using YouTube's embed code. Now, the bit of code was working perfectly and doing exactly what I ask it to. Except, the problem is it for some reason only works for the first and second question, and even though it shows a link for the third question it will not allow you to click on it and this whole thing is killing my brain. I've attempted to debug the code myself, but Firebug and the Mozilla Console show that no errors are running, and since I can't actually click on the link to even see if it would give me an error I'm completely stumped. I've cleared the code out, switched it all around, and for some reason it just won't do it for the third question, regardless of if I switched it out. So, here is the code in question. I'm just going to show the first snippets of it because it is just about copied and pasted over and over again. Code: $(document).ready(function() { $('#q1').click(function() { $('#qbox h3').html('<h3>What have you done to stop illegal aliens from getting taxpayer funded healthcare?</h3>'); $('#abox').html('<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/f9GH-yvPHSY&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/f9GH-yvPHSY&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'); }); and Code: <tr> <td><h2>Q1:</h2></td> <td><a href="#" id="q1"><p>What have you done to stop illegal aliens from getting taxpayer funded healthcare?</p></a></td> </tr> Anyways, thank you so very much for taking a look at this. Any suggestions would be greatly appreciated! I have a few java events attached to a couple rollover buttons. They seem to all work just great on every browser but ie8 for some reason. Code: <script type="text/javascript"src="lookbook_web/mouseovers.js"> <div id="thumb_container"> <div id="thumb1"><a href="javascript:void()"onmouseover="ShowPage('fra me1')"onclick="ShowPage('frame1')" rel="nofollow" rel="nofollow" target="mainbox"></a></div> <div id="thumb2"><a href="javascript:void()"onmouseover="ShowPage('fra me2')"onclick="ShowPage('frame2')" rel="nofollow" rel="nofollow" target="mainbox"></a></div> <div id="thumb3"><a href="javascript:void()"onmouseover="ShowPage('fra me3')"onclick="ShowPage('frame3')" rel="nofollow" rel="nofollow" target="mainbox"></a></div> And then the mouseovers.js file looks like this (this is just a script i found online and edited so my guess is that the issue is here): Code: function ShowPage(frame1) //Display in the i-frame, the page whose name is aName { { frames[0].location = frame1+'.html' } function ShowPage(frame2) //Display in the i-frame, the page whose name is aName { frames[0].location = frame2+'.html' } function ShowPage(frame3) //Display in the i-frame, the page whose name is aName { frames[0].location = frame3+'.html' } } Like i said, works on ffox, safari, ie7, chrome.. so im sort of at a loss. Ideas? Hey everyone I want to go ahead and say my issue with javascript is in a homework assignment so...I'm just looking to get more of a nudge in the right direction of how to fix this issue than anything ^^' I'm not asking to have the code fixed for me. I've been assigned to code a simple currency converter of just US dollars to a few other kinds of currency. I have most of the basic stuff done, I used an example piece of javascript and am editing it to try and make it into what I need. I'm just having issues with the button that is supposed to run the function and output the value of the currency, I can't seem to get the button to work. Here is the code I've gotten so far, if someone could just point out maybe where the issue is as sort of a hint I'd be really grateful! Code: <html> <head> <title>Currency Converter</title> <script type = "text/javascript"> function calcvalue() { if (CurrencyType == "USDollars") {price = 1;} if (CurrencyType == "BritishPounds") {price = 0.632766;} if (CurrencyType == "Euros") {price = '.709723';} if (CurrencyType == "CanadianDollars") {price = 0.970476;} if (CurrencyType == "JapaneeseYen") {price = 83.073;} if (CurrencyType == "ChineeseYuan") {price = 6.55649; Currency.answer.value=price*DollarAmount; } if (!( DollarAmount >= 1001 || DollarAmount <= 0)) { alert ("Please Enter a value between 1 and 1000"); return; } } </script> <body> <body bgcolor="CCCCFF"> <form name="Currency"> <center> <table> <tr> <td>Currency Type: </td> <td> <select name="Currency"> <option value="USDollars">US Dollars</option> <option value="BritishPounds">British Pounds</option> <option value="Euros">Euros</option> <option value="CanadianDollars">Canadian Dollars</option> <option value="JapaneeseYen">Japaneese Yen</option> <option value="ChineeseYuan">Chineese Yuan</option> </select> <tr> <td>Dollar Amount</td> <td> $<input type=parsefloat() value="1" name="DollarAmount" size=3></td> </tr> <tr> <td> </td> <td><p class="submit"> <input type=button value="Convert" onclick=calcvalue()></p></td> </tr> <tr> <td>value:</td> <td><input type=text size=6 name="answer"><td> </tr> </table> </center> </form> </body> </html> I need to allow a user to enter 3 values, then display the average between them... I am having some real issues with the average, Thanks! var quiz1 = prompt("What is the score of your first quiz?", "") document.write("Return Value: "+quiz1, '%',("<br />")); var quiz2 = prompt("What is the score of your second quiz?", "") document.write("Return Value: "+quiz2, '%',("<br />")); var quiz3 = prompt("What is the score of your third quiz?", "") document.write("Return Value: "+quiz3,'%',("<br />")); average= ("quiz1"+"quiz2"+"quiz3") /3 document.write(average,("<br />")); I hired psd2html.com to code my portfolio website because I had no idea where to start. They designed a specific gallery for me and I don't like it anymore, and it's the last thing holding my back from making my portfolio live. Here is what it looks like right now: http://www.mustlovepink.com/index2.html I attached an image that describes what I would like the gallery to look like. I don't think it's all that different, but the code is honestly such a mess that I need someone to help me with it. I don't even know where to begin If you need more information in order to tell me, feel free to let me know. I really want to get this thing figured out. Hi guys, Great site by the way =). Basically if you view http://debtclock.co.uk/contact and click the form submit before inputting any details in the boxes you will see that the boxes highlight red to indicate there are some fields missing. Everything works fine, but if you view it on I.E 8 you can see that the red fill doesnt appear, only the text above it saying there are errors. Anyway I hope someone can get back to me with an idea, I am sat here in the office pulling my hair out not having an idea what it could be ><><>< I am in the process of developing a form for the company intranet and i've recently added in code to capture the enter key event to prevent the page from automatically submitting. Along with this, i added code to move the focus to the next element in the tab index. When used in IE, the code works perfectly, but when i use it in firefox or chrome the focus jumps to the same box every time. I don't know what i'm doing wrong am i'm hoping someone can help me figure this out. You can test the page at http://implicitarts.com/fandfwork/Lo...l/default.aspx To start, go to the box for duty amount or freight charges and press enter The following code is what I used to handle this event. Code: function handleKeyPress2(e,control) { var evt = e ? e : window.event; var bt = control.id; if (bt) { if (evt.keyCode == 13) { //bt.click(); jumptoNext(control, e); stopEvent(e); return false; } } } function jumptoNext(field, event) { for (i = 0; i < field.form.elements.length; i++) if (field.form.elements[i].tabIndex == field.tabIndex + 1) { field.form.elements[i].focus(); if (field.form.elements[i].type == "text") field.form.elements[i].select(); break; } } function stopEvent(e) { if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type='text/javascript'> function myForm(){ // Make quick references to our fields var fname = document.getElementById('fname'); var lname = document.getElementById('lname'); var address = document.getElementById('address'); var city = document.getElementById('city'); var state = document.getElementById('state'); var zcode = document.getElementById('zcode'); var email = document.getElementById('email'); // Check each input in the order that it appears in the form! if(isAlphabet(fname, "Please enter only letters for your first name")){ if(isAlphabet(lname, "Please enter only letters for your last name")){ if(isAlphanumeric(address, "Numbers and Letters Only for Address")){ if(isAlphabet(city, "Please enter only letters for your city name")){ if(madeSelection(state, "Please Choose a State")){ if(isNumeric(zcode, "Please enter a valid zip code")){ if(emailValidator(email, "Please enter a valid email address")){ return true; } } } } } } } return false; } function formChoice(elem, helperMsg){ if(elem.fname, elem.lname, elem.address, elem.city, elem.state, elem.zcode == 0 || elem.email == 0){ return true; }else{ alert(helperMsg); elem.focus(); return flase; } } function isNumeric(elem, helperMsg){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function isAlphabet(elem, helperMsg){ var alphaExp = /^[a-zA-Z]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function isAlphanumeric(elem, helperMsg){ var alphaExp = /^[0-9a-zA-Z\s]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function madeSelection(elem, helperMsg){ if(elem.value == "Please Choose"){ alert(helperMsg); elem.focus(); return false; }else{ return true; } } function emailValidator(elem, helperMsg){ var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; if(elem.value.match(emailExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } </script> </head> <body> <p>My Form.</p> <form action="conformation.html" target="_self" onsubmit="return myForm()"> <fieldset> <legend>Name</legend> First Name: <input type="text" id="fname" value="" /> <br /> Last Name: <input type="text" id="lname" value="" /> <br /> </fieldset> <br /> <fieldset> <legend>Address</legend> Address: <input type="text" id="address" value="" /> <br /> City: <input type="text" id="city" value="" /> <br /> State: <select id="state"> <option>Please Choose</option> <option>AL</option> <option>AK</option> <option>AZ</option> <option>AR</option> <option>CA</option> <option>CO</option> <option>CT</option> <option>DE</option> <option>FL</option> <option>GA</option> <option>HI</option> <option>ID</option> <option>IL</option> <option>IN</option> <option>IA</option> <option>KS</option> <option>KY</option> <option>LA</option> <option>ME</option> <option>MD</option> <option>MA</option> <option>MI</option> <option>MN</option> <option>MS</option> <option>MO</option> <option>MT</option> <option>NE</option> <option>NV</option> <option>NH</option> <option>NJ</option> <option>NM</option> <option>NY</option> <option>NC</option> <option>ND</option> <option>OH</option> <option>OK</option> <option>OR</option> <option>PA</option> <option>RI</option> <option>SC</option> <option>SD</option> <option>TN</option> <option>TX</option> <option>UT</option> <option>VT</option> <option>VA</option> <option>WA</option> <option>WV</option> <option>WI</option> <option>WY</option> </select> <br /> Zip Code: <input type="text" id="zcode" value="" /> <br /> </fieldset> <br /> <br /> <fieldset> <legend>E-mail Address</legend> E-mail Address: <input type="text" id="email" value="" /> <br /> </fieldset> <input type="submit" value="Submit" /> </form> </body> </html> Hello Everyone - I am trying to make a form that requires a user to either enter in their mailing address and or e-mail or both. For example, if somebody only enters in their e-mail address the form would validate correctly and send the validation information to a conformation page. Or, the other s scenario would be they entered their mailing address information but left the e-mail field blank, the form would validate and confirm the form information on a conformation page. Or the last scenario would be that all fields were filled out, which then wouldn't be an issue(my form does this now). What I have done was made a custom function, which is in the code above on line, 39 and then have it called on an onsubmit button but that wasn't working. Code he Code: function formChoice(elem, helperMsg){ if(elem.fname, elem.lname, elem.address, elem.city, elem.state, elem.zcode == 0 || elem.email == 0){ return true; }else{ alert(helperMsg); elem.focus(); return flase; } } The other thing I tried to do was making the if on line 25 an else if else and or just an else. I understand with an else if the condition are not met than the if statement moves on to the else and if that isn't met then both statements are false and the form will not submit, but both else if else, and else doesn't work at line 25. I tried moving the line 25 e-mail line down past the brackets and that didn't work. I have read many books and have visited many sites to try on my own to learn how to do this, and I think I am not understanding some basic concepts, and I would be tickled if somebody could look at my code and look at my problem and see what knowledge I am missing and how to fix my problem. Thanks. Hi, I'm fairly new to javascript, I created a javascript image gallery using a tutorial found on web monkey. Please see below: Code: <script language="JavaScript" type="text/javascript"> <!-- var interval = 1500; var random_display = 0; var image_dir = "images/exhibition/" var ImageNum = 0; imageArray = new Array(); imageArray[ImageNum++] = new imageItem(image_dir + "exhibition-sealskinz.png"); imageArray[ImageNum++] = new imageItem(image_dir + "exhibition-orchard.png"); var number_of_image = imageArray.length; function imageItem(image_location) { this.image_item = new Image(); this.image_item.src = image_location; } function get_ImageItemLocation(imageObj) { return(imageObj.image_item.src) } function randNum(x, y) { var range = y - x + 1; return Math.floor(Math.random() * range) + x; } function getNextImage() { if (random_display) { ImageNum = randNum(0, number_of_image-1); } else { ImageNum = (ImageNum+1) % number_of_image; } var new_image = get_ImageItemLocation(imageArray[ImageNum]); return(new_image); } function getPrevImage() { ImageNum = (ImageNum-1) % number_of_image; var new_image = get_ImageItemLocation(imageArray[ImageNum]); return(new_image); } function prevImage(place) { var new_image = getPrevImage(); document[place].src = new_image; } function rotateImage(place) { var new_image = getNextImage(); document[place].src = new_image; var recur_call = "rotateImage('"+place+"')"; timerID = setTimeout(recur_call, interval); } // --> </script> However unfortunately there are two issues, one is IE6 is coming up with javascript errors and IE7 gets an error when you click the previous button on the first image. The buttons look like this: Code: <div id="left-arrow-container"><a href="#" onClick="prevImage('rImage'); clearTimeout(timerID)"><img src="images/left-arrow.png" alt="left arrow" name="leftarrow" width="58" height="37" border="0" id="leftarrow" /></a></div> <div id="see-the-whole-project"> see the whole project</div> <div id="right-arrow-container"><a href="#" onClick="rotateImage('rImage'); clearTimeout(timerID)"><img src="images/right-arrow.png" alt="right arrow" name="rightarrow" width="58" height="36" border="0" id="rightarrow" /></a></div> Being new to javascript I don't know how to get round these issues so if anyone could advise me I would really appreciate it. Thanks Gary My function below only works if all variables have values. The variable "points", "income" and "shippingPrice" are optional inputs by the user. If I leave these text fields blank the "balance" value becomes "NaN". I need some help on this function to calculate "balance" value although variable "points", "income" and "shippingPrice" are blank. Another thing is I want the output of "balance" value in 2 decimal points (money). function findBalance () { var itemPrice = <?php echo $Price; ?> var points = parseFloat(document.getElementById("text1").value); var income = parseFloat(document.getElementById("text2").value); var shippingPrice = parseFloat(document.getElementById("shippingPrice").value); var balance = document.getElementById("balance"); balance.value = itemPrice + shippingPrice - points - income; } on the folowing page - after the main content area - are tabs - when the page first loads - what you see is actually the first 2 tabs combined. if you click a tab and come back - it fixes itself. I can't figure out why this is happening? thanks in advance http://www.challengerlifts.com/CLFP9.shtml the javascript file is here http://www.challengerlifts.com/tabcontent.js I am having an issue with my foor loop count-controlled input in Javascript. My code works, however, it does not allow three different users to enter three different values, instead it repeats what one user enters twice. ... Any suggestions? Thanks! CODE is below.... var hours; var rate; var tax; var gross; var deduction; var empl; var numEmpl; var accumulator; totalNet = 0; totalGross = 0; var hours = prompt("How many hours have you worked?", "") while ((hours < 0) || (hours > 80)); document.write("Total Hours: " + hours,("<br />")); var rate = prompt("What is your pay rate?", "") while ((rate < 7.50) || (rate > 15)); document.write("Pay Rate: $" + rate,("<br />")); gross = hours * rate; document.write("Gross Pay: $" + gross,("<br />")); if (hours < 40) { taxRate = .15 / 10; } else { taxRate = .30 / 10; } deduction = taxRate * gross document.write("Deduction: $" + deduction,("<br />")); net = gross - deduction document.write("Net Pay: $" + net,("<br />")); for (count = 1; count < 4; count ++) { document.write("Employee # " + count, " worked " + hours, " hours at $", + rate, " per hour for gross pay of $ ", + gross, " and net pay of $ ", + net, " based on a tax rate of ", + taxRate * 1000, "%", ("<br />")); count++; totalNet+= parseInt(net); totalGross+= parseInt(gross); } document.write("Total gross pay is: $" + totalGross, ("<br />")); document.write("Total net pay is: $" + totalNet, ("<br />")); |