JavaScript - If Statement Not Working Properly
Hello There!
I am fairly new to javascript and am in need of some help. I am trying to make a simple script that tells you what class period it is. I've gotten everything working except for the If statement that tells you what period it is. I can't figure out if i'm doing something wrong, and it's starting to drive me insane. Here's the code for the script. I've tried to comment it as much as possible to make it easy to understand. Code: //define variables //Get current time var currentTime = new Date(); var hours = currentTime.getHours(); var minutes = currentTime.getMinutes(); //First period var period1 = prompt("Please enter your First Period Class","Ex: Science"); console.log ("First period is: " +period1+ "." ); //Second Period var period2 = prompt("Please enter your Second Period Class","Ex: PE"); console.log ("Second period is: " +period2+ "." ); //Third Period var period3 = prompt("Please enter your Third Period Class","Ex: Language Arts"); console.log ("Third period is: " +period3+ "." ); //Fourth Period var period4 = prompt("Please enter your Fourth Period Class","Ex: Math"); console.log ("Fourth period is: " +period4+ "." ); //Fifth Period var period5 = prompt("Please enter your Fifth Period Class","Ex: MSI"); console.log ("Fifth period is: " +period5+ "." ); //Sixth Period var period6 = prompt("Please enter your Sixth Period Class","Ex: Band"); console.log ("Sixth period is: " +period6+ "." ); //Seventh period var period7 = prompt("Please enter your Seventh Period Class","Ex: History"); console.log ("Seventh period is: " +period7+ "." ); //If minutes are less than 10 add zero before number if (minutes < 10){ minutes = "0" + minutes; } //Add a blank Line console.log (); //Show Current time console.log ("Current time is " + hours + ":" + minutes); //Define variable time var time = (hours + "." + minutes); //Before School if (time >= 0.01 & time <= 7.40) console.log ("School hasn't started yet."); //After School if (time >= 3.20 & time <= 0.00) console.log ("School is over."); This is all that i've gotten so far. I haven't filled in any of the other periods, because this problem is driving me insane! Thank you for your help. --Tab00 Similar Tutorialsfor(var i=0; i<orderItemIndex; i++){ document.writeln('<tr>'); } document.writeln('<td>' + orderItemIndex[0] + '</td>'); document.write('<td>' + productName[0] + '</td>'); document.write('<td> $' + sausagePrice + '</td>'); document.write('<td> ' + orderItemQty[0] + '</td>'); document.write('<td> ' + sausageTotal + '</td>'); document.writeln('</tr>'); } orderItemIndex is an array with user inputs in it, I'm trying to make a new row for each individual array, the table is creating correctly but the loop is not working, if several inputs are added it just outputs the last input to one row, instead of making a new one each time, what am I missing? (The code above has other problems I know but I'm working on this first) Reply With Quote 01-07-2015, 06:50 PM #2 sunfighter View Profile View Forum Posts Senior Coder Join Date Jan 2011 Location Missouri Posts 4,830 Thanks 25 Thanked 672 Times in 671 Posts document.write() is a horrible way to do anything. It certainly will not insert anything, what it does is over write anything on your page so if you have a table defined with HTML the document.write() will wipe it out. Look at HTML DOM Table insertRow() Method Greetings, I'm trying to retrieve the respective value from the text boxes. Unfortunate the value i retrieve and added always point to the first text box. Can anyone out there help me with these. Thanks in advance. Code: <td align='center'> <input name='txtQty[]' type='text' id='txtQty[]' size='5' value='$od_qty' class='box'/><br></br> <input type='image' name='btnAdd' src='library/cart add.png' onclick=\"document.getElementById('txtQty[]').value++;\"/> <input type='image' name='btnSubtract' src='library/cart remove.png' onclick=\"document.getElementById('txtQty[]').value--;\"/> <input name='hidTpcd[]' type='hidden' value='$od_tpcd'/> </td> Regards, Juz Hi All, I had to switch to Mootools, because the current company I am working for uses MooTools. Till thus far I haven't had any problems with MooTools until about 10min ago. I am using a plug in called noobSlide, You can check it out here http://www.efectorelativo.net/laboratory/noobSlide/ My problem is that for some or other reason it displays 5 images instead of 4 images(the amount I am using), leaving the lastly displayed image blank. Code: Head: <link rel="stylesheet" type="text/css" href="./css/liquidstyle.css" /> <link rel="stylesheet" type="text/css" href="./css/screen.menumatic.css" /> <link rel="stylesheet" type="text/css" href="./css/jd.gallery.css" /> <script src="../root/scripts/core.js" type="text/javascript"></script> <script src="../root/scripts/mootools-1.2.1-core.js" type="text/javascript"></script> <script src="../root/scripts/mootools-1.2-more.js" type="text/javascript"></script> <script src="../root/scripts/menumatic.js" type="text/javascript"></script> <script src="../root/scripts/com_form.js" type="text/javascript"></script> <script src="../root/scripts/com_list.js" type="text/javascript"></script> <script src="../root/scripts/com_panel.js" type="text/javascript"></script> <script src="../root/scripts/com_tab.js" type="text/javascript"></script> <script src="../root/scripts/roar.js" type="text/javascript"></script> <script src="../root/scripts/jd.gallery.js" type="text/javascript"></script> <script src="../root/scripts/jd.gallery.transitions.js" type="text/javascript"></script> <script src="../root/scripts/_class.noobSlide.packed.js" type="text/javascript"></script> Code: page: <script type="text/javascript"> window.addEvent('domready',function(){ var nS2 = new noobSlide({ box: $('box2'), size: 945, items: [0,1,2,3,4], interval: 3000, fxOptions: { duration: 2500, transition: Fx.Transitions.Bounce.easeOut, wait: false }, addButtons: { previous: $('prev1'), next: $('next1') } }); }); </script> Code: HTML: <div class="mask2"> <div id="box2"> <span class="sShow"><img src="images/branding_your_website/img_1.jpg" alt="Photo" /></span> <span class="sShow"><img src="images/branding_your_website/img_2.jpg" alt="Photo" /></span> <span class="sShow"><img src="images/branding_your_website/img_3.jpg" alt="Photo" /></span> <span class="sShow"><img src="images/branding_your_website/img_4.jpg" alt="Photo" /></span> </div> </div> <p class="buttons"> <span id="prev1"><< Previous</span> <span id="next1">Next >></span> </p> Thanks in advance I have 2 tables with Add/Remove Row buttons. The first table's Add Row button adds a row that belongs in the second table, and the Remove Row button gives me an Object Error. The second table works properly. The JavaScript for both tables is identical except for the ID's. When the tables are put into seperate html files both of the Add buttons work properly, but the remove row button from table one is still giving me the Object Error. Can someone point out what i'm doing wrong? Thanks. Code for the first table Code: <SCRIPT language="javascript"> function addRow(kodaktable) { var table = document.getElementById(kodaktable); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; cell1.appendChild(element1); var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "text"; cell2.appendChild(element2); var cell3 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell3.appendChild(element2); var cell4 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell4.appendChild(element2); var cell5 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell5.appendChild(element2); var cell6 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell6.appendChild(element2); } </script> <script> function deleteRow(kodaktable) { try { var table = document.getElementById(kodaktable); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++) { var row = table.rows[i]; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox && true == chkbox.checked) { table.deleteRow(i); rowCount--; i--; } } }catch(e) { alert(e); } } </SCRIPT> <INPUT type="button" value="Add Row" onClick="addRow('kodaktable')" /> <INPUT type="button" value="Delete Row" onClick="deleteRow('kodaktable')" /> <TABLE id="kodaktable" width="350px" border="1"> <TR> <tr> <th></th> <th>Job Name</th> <th>Job Number</th> <th>Start Doc</th> <th>End Doc</th> <th>Total</th> </tr> <tr> <td><INPUT type="checkbox" name="chk"/></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> <td><input type="text" name="name" /></td> </tr> </TR> </TABLE> code for the second table. Code: <SCRIPT language="javascript"> function addRow(incidenttable) { var table = document.getElementById(incidenttable); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; cell1.appendChild(element1); var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "text"; element2.size = "70"; cell2.appendChild(element2); var cell3 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; element2.size = "20"; cell3.appendChild(element2); var cell4 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; element2.size = "20"; cell4.appendChild(element2); } function deleteRow(incidenttable) { try { var table = document.getElementById(incidenttable); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++) { var row = table.rows[i]; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox && true == chkbox.checked) { table.deleteRow(i); rowCount--; i--; } } }catch(e) { alert(e); } } </SCRIPT> <INPUT type="button" value="Add Row" onClick="addRow('incidenttable')" /> <INPUT type="button" value="Delete Row" onClick="deleteRow('incidenttable')" /> <table id="incidenttable" width="790px" border="1"> <tr> <th></th> <th>Incident</th> <th>Kodak Downtime</th> <th>System Downtime</th> </tr> <tr> <td><INPUT type="checkbox" name="chk"/></td> <td><input type="text" name="name" size="70" /></td> <td><input type="text" name="name" size="20"></td> <td><input type="text" name="name" size="20"></td> </tr> </table> Hi, I am having a strange problem. I have a javascript that I am running on my system and on server(both in IE and FF). The problems I am encountering are as follows: My system IE - everything working fine FF - Not able to set focus correctly. When focus() is called, it jumps to next field. On Server IE - Focus doesnt set as expected. No blinking cursor.Doesnt do anything. FF- Same thing as above. When focus functionality is called, nothing happens. It is a long javascript, but here is a snapshot of the code with problem. Please let me know if you want to know about any variables. The (fname,lname..)are all the Name attributes of textbox. userArray is a array containg the number of users whose information is not filled up correctly(ie. some reqd fields are left empty). Code: df=document.form; for(var j=0;j< val;j++) { if(df['fname'+userArray[j]].value =="") { df['fname'+userArray[j]].focus(); break; } else if(df['lname'+userArray[j]].value =="") { df['lname'+userArray[j]].focus();break; } else if(df['ph'+userArray[j]].value =="") { df['ph'+userArray[j]].focus();break; } else if(df['email'+userArray[j]].value =="") { df['email'+userArray[j]].focus();break; } else if(df['comp'+userArray[j]].value =="") { df['comp'+userArray[j]].focus();break; } else if(df['addra'+userArray[j]].value =="") { df['addra'+userArray[j]].focus();break; } else if(df['city'+userArray[j]].value =="") { df['city'+userArray[j]].focus();break; } else if(df['state'+userArray[j]].value =="") { df['state'+userArray[j]].focus();break; } else if(df['zip'+userArray[j]].value =="") { df['zip'+userArray[j]].focus();break; } else if(df['country'+userArray[j]].value =="") { df['country'+userArray[j]].focus();break; } } The code is definitely not clean,pls forgive me for that. Any suggestion on that will be appreciated. Thanks Hello, i am a total newbie, so forgive me i have the following problem: a Joomla Gallery uses a javascript to show fullsize images. but when the popup windows comes out, it doesn't have any properties (page title, url about:blank, blank background etc) here is a screenshot: I think the following to be the code that calls the popup: what's wrong? NOTE I already had to remove some "spaces" from the code because the Joomla SEF was changing the urls forbidding the right execution of everything, maybe it's something like that... dunno :cry: Code: $htmltext2 .= "<script language=\"JavaScript\">"; $htmltext2 .= "function pgpopup(pgimagefile,pgimagetitle,pgimagedescription) {\n"; $htmltext2 .= "var newWindow = window.open(\"\",\"newWindow\",\"height=" . ($tabparams["pgmaxheight"]+$dparm[2]) . ",width=" . ($tabparams["pgmaxwidth"]+$dparm[3]) . ",resizable=yes, scrollbars=yes, toolbar=no " . "\" );\n"; $htmltext2 .= "var imageurl = \"<img src= \"+ pgimagefile + \">\";\n"; $htmltext2 .= "newWindow.document.open();"; $htmltext2 .= "newWindow.document.writeln(\"<div align='center' >\");\n"; $htmltext2 .= "newWindow.document.writeln(\"<title>Profile Gallery Image: \"+ pgimagetitle + \"</title>\");\n"; $htmltext2 .= "newWindow.document.writeln(imageurl);\n"; $htmltext2 .= "newWindow.document.writeln(\"<br />\");"; $htmltext2 .= "newWindow.document.writeln(pgimagedescription);\n"; $htmltext2 .= "newWindow.document.writeln(\"</div>\");\n"; $htmltext2 .= "newWindow.document.close();\n"; $htmltext2 .= "}\n"; $htmltext2 .= "</script>"; break; anyone can help? thanks! Hello, We have jcarousel on our forum site which rotates automatically. It is vbulletine forum. In fact originally it was working fine with old design and rotating images automatically in horizontal direction with a set of 5 images visible at a time and total 12 images in set. But we have upgraded our forum design in last week and I started getting issues with Jcarousel scroller. Our site URL is http://newtest.naturalparenting.com.au Please go at any topic and post page finally, Below first post there is a scroller e.g http://newtest.naturalparenting.com....ad.php?t=42713 While old site design is still active at http://ninad.naturalparenting.com.au Please go at any topic and post page finally, Below first post there is a scroller e.g http://ninad.naturalparenting.com.au...ad.php?t=40745 At new design when we implemented jcarousel scroller it is showing only one image in a horizontal row at jscroller and it disappears immediately and after 3-4 min it do reappear again. When I inspected it using firebug I have noticed that other images are coming below vertically not horizontally, really strange. Also I noticed another thing is that it is not updating width at element.style in firebug for UL tag. It is showing fix width 220 px all time. I think due to that all images appearing vertically one after one rather than horizontally. It is really very strange issue for me. I have tried all ways to fix it but alas !!! Any help would be greatly appreciated. Code: <style type="text/css"> .jcarousel-skin-tango .jcarousel-container { -moz-border-radius: 0px; background: transparent; border: 0px solid #CEC8B7; } .jcarousel-skin-tango .jcarousel-direction-rtl { direction: rtl; } .jcarousel-skin-tango .jcarousel-container-horizontal { width: 695px; padding: 20px 30px; } .jcarousel-skin-tango .jcarousel-container-vertical { width: 75px; height: 220px; padding: 40px 20px; } .jcarousel-skin-tango .jcarousel-clip-horizontal { height: 220px; margin-left: auto; margin-right: auto; width: 675px; } .jcarousel-skin-tango .jcarousel-clip-vertical { width: 75px; height: 220px; } .jcarousel-skin-tango .jcarousel-item { width: 75px; height: 75px; } .jcarousel-skin-tango .jcarousel-item-horizontal { margin-left: 0; margin-right: 10px; } .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-item-horizontal { margin-left: 10px; margin-right: 0; } .jcarousel-skin-tango .jcarousel-item-vertical { margin-bottom: 10px; } .jcarousel-skin-tango .jcarousel-item-placeholder { background: #fff; color: #000; } /** * Horizontal Buttons */ .jcarousel-skin-tango .jcarousel-next-horizontal { position: absolute; top: 83px; right: 5px; width: 32px; height: 32px; cursor: pointer; /* background: transparent url(images/checkout/nivo_nav.png) no-repeat scroll right top;*/ } .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-next-horizontal { left: 5px; right: auto; background: transparent url(images/checkout/nivo_nav.png) no-repeat scroll right top; } .jcarousel-skin-tango .jcarousel-next-horizontal:hover { background-position: -32px 0; } .jcarousel-skin-tango .jcarousel-next-horizontal:active { background-position: -64px 0; } .jcarousel-skin-tango .jcarousel-next-disabled-horizontal, .jcarousel-skin-tango .jcarousel-next-disabled-horizontal:hover, .jcarousel-skin-tango .jcarousel-next-disabled-horizontal:active { cursor: default; background-position: -96px 0; } .jcarousel-skin-tango .jcarousel-prev-horizontal { position: absolute; top: 83px; left: 5px; width: 31px; height: 31px; cursor: pointer; /*background: transparent url(images/checkout/nivo_nav.png) no-repeat scroll left top;*/ } .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-prev-horizontal { left: auto; right: 31px; /*background-image: url(images/checkout/nivo_nav.png);*/ } .jcarousel-skin-tango .jcarousel-prev-horizontal:hover { background-position: -32px 0; } .jcarousel-skin-tango .jcarousel-prev-horizontal:active { background-position: -64px 0; } .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal, .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal:hover, .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal:active { cursor: default; background-position: -96px 0; } /** * Vertical Buttons */ .jcarousel-skin-tango .jcarousel-next-vertical { position: absolute; bottom: 5px; left: 43px; width: 32px; height: 32px; cursor: pointer; background: transparent url(next-vertical.png) no-repeat 0 0; } .jcarousel-skin-tango .jcarousel-next-vertical:hover { background-position: 0 -32px; } .jcarousel-skin-tango .jcarousel-next-vertical:active { background-position: 0 -64px; } .jcarousel-skin-tango .jcarousel-next-disabled-vertical, .jcarousel-skin-tango .jcarousel-next-disabled-vertical:hover, .jcarousel-skin-tango .jcarousel-next-disabled-vertical:active { cursor: default; background-position: 0 -96px; } .jcarousel-skin-tango .jcarousel-prev-vertical { position: absolute; top: 5px; left: 43px; width: 32px; height: 32px; cursor: pointer; background: transparent url(prev-vertical.png) no-repeat 0 0; } .jcarousel-skin-tango .jcarousel-prev-vertical:hover { background-position: 0 -32px; } .jcarousel-skin-tango .jcarousel-prev-vertical:active { background-position: 0 -64px; } .jcarousel-skin-tango .jcarousel-prev-disabled-vertical, .jcarousel-skin-tango .jcarousel-prev-disabled-vertical:hover, .jcarousel-skin-tango .jcarousel-prev-disabled-vertical:active { cursor: default; background-position: 0 -96px; } #upsell { margin-bottom: 10px; margin-top: 0; text-align: center; } #upsell li { border: 0 dashed #CCCCCC; float: left; height: 220px; list-style: none outside none; margin: 0 10px 0 0; padding: 2px; width: 125px; } </style> <script type="text/javascript" src="/resources/scripts/jquery-1.4.2.min.js"></script> Hi guys, I am having a problem where the sorting function I have designed is supposed to sort an array of records into descending order in terms of each record's "score" value, I would expect the below code to alert 2,1,0 in that order but it's as if the code didn't even sort it. Help would greatly be appreciated Code: var g=[{sco 0,index:0},{sco 2,index:1},{sco 1,index:2}] function sortScores(scoreRecs){ var swapped; do for(i=0;i<scoreRecs.length-1;i++){ if(scoreRecs[i].score<scoreRecs[i+1].score){ var a=scoreRecs[i] var b=scoreRecs[i+1] var c=a; a=b; b=c; swapped=true; } else{ swapped=false; } } while(swapped==true) } sortScores(g); alert(g[0].score); alert(g[1].score); alert(g[2].score); Hi, While i am binding a value to a text box using java script. It will properly in all browsers other than IE. In IE the value bind as 'undefined' in the text box . so please provide solution for this one. The code sample is given below. In this "Flight Search " is the text box id . I have to bind that value from the previous page selected value. function SelectAirport(val) { var id = val + "_lnkCity"; var lnk = document.getElementById(id); window.opener.document.getElementById("FlightSearch").value = lnk.text; window.opener.document.getElementById("destinationSearch").value = lnk.text; window.close(); } I have an "animated slideshow" of 29 jpeg images on a page created using Javascript. It works fine in Internet Explorer and Firefox but not Safari or Chrome. The jpeg files names are 01.jpg through to 29.jpg. Here below is the code in the header and the body. There is an error in there somewhe <html> <head> <title>My webpage</title> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <SCRIPT language="JavaScript" type="text/JavaScript"> <!-- var speed=1333; var counter = 1; function rollPics() { document.display.src=counter+".jpg"; //Display image "counter".jpg counter ++; // Add 1 to counter if (counter>29) { // If counter is greater than 29 images then reset it counter=1 } } <!-- END --> </SCRIPT> </head> <body> <center> <table> <tr><td> <IMG NAME="display" SRC="1.jpg" onLoad="setTimeout('rollPics()',1333)"> </td></tr> </table> </center> </body> </html> I made a php page with multiple forms with javascript code in it. The javascript makes an input field for the date. The problem is that the script interfers between other scripts in the other forms and i get wrong orderdate. Code: <form action='dataadd.php' name='$id'>"; $datestime=time(); echo "<input type=hidden name=dateid value='$id'>"; echo "<input type=hidden name=datestime value='$datestime'>";?> <script type="text/javascript"> DateInput('orderdate', true, 'yyyy-mm-dd')</script>.... Hello, I am building a shopping cart website that is using a mega javascript dropdown menu. Everything was working fine until you get to the checkout page on the website. The checkout page has this accordian / spry deal where customers can checkout on one page. You can view it he http://gem-tech.com.mytempweb.com/store/pc/onepagecheckout.asp If I take the menu code out of the header.asp file, then the checkout page works just fine. But if I put the menu code back in, then the checkout page stops working. Here is the menu code (simplified it a bit for this thread): Quote: <head> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> Quote: <body><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript" src="jquery.hoverIntent.minified.js"></script> <script type="text/javascript"> $(document).ready(function() { function megaHoverOver(){ $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Calculate width of all ul's (function($) { jQuery.fn.calcSubWidth = function() { rowWidth = 0; //Calculate row $(this).find("ul").each(function() { rowWidth += $(this).width(); }); }; })(jQuery); if ( $(this).find(".row").length > 0 ) { //If row exists... var biggestRow = 0; //Calculate each row $(this).find(".row").each(function() { $(this).calcSubWidth(); //Find biggest row if(rowWidth > biggestRow) { biggestRow = rowWidth; } }); //Set width $(this).find(".sub").css({'width' :biggestRow}); $(this).find(".row:last").css({'margin':'0'}); } else { //If row does not exist... $(this).calcSubWidth(); //Set Width $(this).find(".sub").css({'width' : rowWidth}); } } function megaHoverOut(){ $(this).find(".sub").stop().fadeTo('fast', 0, function() { $(this).hide(); }); } var config = { sensitivity: 2, // number = sensitivity threshold (must be 1 or higher) interval: 100, // number = milliseconds for onMouseOver polling interval over: megaHoverOver, // function = onMouseOver callback (REQUIRED) timeout: 500, // number = milliseconds delay before onMouseOut out: megaHoverOut // function = onMouseOut callback (REQUIRED) }; $("ul#topnav li .sub").css({'opacity':'0'}); $("ul#topnav li").hoverIntent(config); }); </script> </body> And there are two things of script on the onepagecheckout.asp page as well. Here they a Quote: <script type="text/javascript"> $(document).ready(function() { $('#chkPayment').click(); }); </script> Quote: <script type="text/javascript"> var acc1 = new Spry.Widget.Accordion("acc1", { useFixedPanelHeights: false, enableAnimation: false }); var currentPanel = 0; <% if session("idCustomer")>"0" then session("OPCstep")=2 else session("OPCstep")=0 end if %> //* Find Current Panel <% if len(Session("CurrentPanel"))=0 AND pcv_strPayPanel="" then %> <% if session("idCustomer")>"0" then %> acc1.openPanel('opcLogin'); GoToAnchor('opcLoginAnchor'); $('#LoginOptions').hide(); $('#ShippingArea').hide(); $('#BillingArea').show(); <% else %> $('#LoginOptions').show(); $('#acc1').hide(); <% end if %> <% else %> <% If pcv_strPayPanel = "1" Then %> $(document).ready(function() { $('#LoginOptions').hide(); pcf_LoadPaymentPanel(); }); <% Else %> acc1.openPanel('opcLogin'); $('#LoginOptions').hide(); $('#ShippingArea').hide(); $('#BillingArea').show(); <% End If %> <% end if %> GoToAnchor('opcLoginAnchor'); function openme(pNumber) { acc1.openPanel(pNumber); } function toggle(pNumber) { var ele = acc1.getCurrentPanel(); var panelNumber = acc1.getPanelIndex(ele); if (panelNumber == pNumber) { acc1.closePanel(pNumber); } else { acc1.openPanel(pNumber); } } function togglediv(id) { var div = document.getElementById(id); if(div.style.display == 'block') div.style.display = 'none'; else div.style.display = 'block'; } function win(fileName) { myFloater=window.open('','myWindow','scrollbars=yes,status=no,width=300,height=250') myFloater.location.href=fileName; } </script> Any help would be GREATLY appreciated, Thank you I've got an annoying non-working bit of code: Code: <div id ="messageDiv" style="display:block;">No profile information entered yet</div> <script type="text/javascript"> function profileInfo() { var m1 = document.getElementById("marital1").innerHTML.toLowerCase(); var b1 = document.getElementById("bodytype1").innerHTML.toLowerCase(); var e1 = document.getElementById("ethnic1").innerHTML.toLowerCase(); var o1 = document.getElementById("occupation1").innerHTML; var w1 = document.getElementById("website1").innerHTML.toLowerCase(); var s1 = document.getElementById("smoker1").innerHTML.toLowerCase(); var d1 = document.getElementById("drinker1").innerHTML.toLowerCase(); var r1 = document.getElementById("religion1").innerHTML.toLowerCase(); if ((m1 == "no answer") && (b1 == "no answer") && (e1 == "no answer") && (o1 == "") && (w1 == '<a href=""></a>') && (s1 == "no answer") && (d1 == "no answer") && (r1 == "no answer")){ document.getElementById("messageDiv").style.display="block"; } else if ((m1 == "no answer") && (b1 == "no answer") && (e1 == "no answer") && (o1 == "") && (w1 == '<a href="http://">http://</a>') && (s1 == "no answer") && (d1 == "no answer") && (r1 == "no answer")){ document.getElementById("messageDiv").style.display="block"; } else { document.getElementById("messageDiv").style.display="none"; } } profileInfo() </script> The first part up to before the 'else if' works. but if the 'w1' has '<a href="http://">http://</a>' it still doesnt return true and display the DIV block?? hi Pals, I have a problem regarding the "target" attribute of "a" tag. in my code I use biggerlink jQuery script to give link to p element without come HTML validation problem. I pass the "target" value from PHP to smarty template , but it's not working , When I remove "biggerlink " it works but the link in <p> tag not working . My Tpl file is : Code: {if not empty($campaign)} <div class="securti-adv biggerlink"> {if not empty ($campaign.media)} <a href="{$campaign.url}" {if n($campaign.linkTarget)}target="{$campaign.linkTarget}"{/if} class="thumb"> <img src="{$campaign.image}" title="{$campaign.title1 + $campaign.title2}" alt="{$campaign.title1 + $campaign.title2}" /> </a> {/if} <div class="details"> {if not empty ($campaign.title1) || not empty ($campaign.sub_title)} <a href="{$campaign.url}" {if not empty($campaign.linkTarget)}target="{$campaign.linkTarget}"{/if} title="{$campaign.title1 + $campaign.title2}"> {text2image styleSlug=$campaign.titleStyle1 text=$campaign.title1} {text2image styleSlug=$campaign.titleStyle2 text=$campaign.title2} <span><img src="{$imagesDir}/btn-campaign-meet-security-advisor.png" alt="" title="" /></span> </a> <p> {text2image styleSlug=$campaign.subtitleStyle text=$campaign.subTitle}</p> {/if} </div> </div> <script type="text/javascript" language="javascript"> {literal} $(document).ready(function(){ $('.biggerlink').biggerlink(); }); {/literal} </script> {/if} My plugin code is : Code: (function($) { $.fn.biggerlink = function(options) { // Default settings var settings = { hoverclass:'hover', // class added to parent element on hover clickableclass:'hot', // class added to parent element with behaviour follow: true // follow link? Set to false for js popups }; if(options) { $.extend(settings, options); } $(this).filter(function(){ return $('a',this).length > 0; }).addClass(settings.clickableclass).each(function(i){ // Add title of first link with title to parent $(this).attr('title', $('a[title]:first',this).attr('title')); // hover and trigger contained anchor event on click $(this) .mouseover(function(){ window.status = $('a:first',this).attr('href'); $(this).addClass(settings.hoverclass); }) .mouseout(function(){ window.status = ''; $(this).removeClass(settings.hoverclass); }) .bind('click',function(){ $(this).find('a:first').trigger('click'); }) // triggerable events on anchor itself .find('a').bind('focus',function(){ $(this).parents('.'+ settings.clickableclass).addClass(settings.hoverclass); }).bind('blur',function(){ $(this).parents('.'+ settings.clickableclass).removeClass(settings.hoverclass); }).end() .find('a:first').bind('click',function(e){ if(settings.follow == true) { window.location = this.href; } e.stopPropagation(); // stop event bubbling to parent }).end() .find('a',this).not(':first').bind('click',function(){ $(this).parents('.'+ settings.clickableclass).find('a:first').trigger('click'); return false; }); }); return this; }; })(jQuery); the value of "target" , "_blank" is not work .... I highlight the code part regarding this, please check and give me a solution ASAP. You can mail me at : anes.pa@gmail.com Thanks, Anes Hey guys, so I'm trying to make a single function that will check to make sure the e-mails in both fields match AND to make sure the e-mail is in proper format. Strangely, with both if statements included the form will return no messages at all. If I comment out the if statement checking for proper format, the if statement to check for matching e-mail works just fine. I want this all to be in one function because I'm wanting it to be executed onSubmit with the form. Let me know what you guys think, any help is greatly appreciated: Code: <html> <head> <script type="text/javascript"> function verifyEmail() { var x = document.forms["emailForm"]["enterEmail"].value; var y = document.forms["emailForm"]["confirmation"].value; var atpos = x.indexOf("@"); var dotpos = x.lastIndexOf("."); if (x != y) { var msg = "The email addresses entered do not match, please enter matching email addresses"; document.getElementById("error").innerHTML = msg; return false; } if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 > = x.length) { var msg = "Improper e-mail format"; document.getElementById("error").innerHTML = msg; return false; } else { return; } } </script> </head> <body> <form name="emailForm" onsubmit="return verifyEmail();" method="post"> E-Mail Address: <input type="text" name="enterEmail"> Confirm E-Mail Address: <input type="text" name="confirmation"> <input type="submit" value="Submit"> <span id="error"></span> </form> </body> </html> Hello everyone, I am using javascript and I have a radio button that the user selects and I have a function to see which button was selected, but i'm trying to use the return of that if statement in another statement. Basically another part of the function is dependent on what the user selects in the radio button. Here is what I have so far (I have some things in there that might not work because i'm trying to figure out what works): Code: <script type="text/javascript"> function getSelectedRadio() { len = document.dates.dep.length // returns the array number of the selected radio button or -1 if no button is selected if (document.dates.dep[0]) { // if the button group is an array (one button is not an array) for (var i=0; i<len; i++) { if (document.dates.dep[i].checked) { return i } } } else { if (document.dates.dep.checked) { return 0; } // if the one button is checked, return zero } // if we get to this point, no radio button is selected return -1; } function Calculate() { var i = getSelectedRadio(); if (i == -1) { alert("Please select if Marine entered Delayed Entry Program"); } else { if (document.dates.dep[i]) { return document.dates.dep[i].value; } else { return document.dates.dep.value; } } if (document.dates.yearDEAF.value < 1985 && document.dates.monthDEAF.value < 01 && document.dates.dayDEAF.value < 01 && first return from above ) { document.dates.yearDEP.value = (document.dates.yearDEAF.value); document.dates.monthDEP.value = (document.dates.monthDEAF.value); document.dates.dayDEP.value = (document.dates.dayDEAF.value); document.dates.yearPEBD.value = (document.dates.yearDEAF.value); document.dates.monthPEBD.value = (document.dates.monthDEAF.value); document.dates.dayPEBD.value = (document.dates.dayDEAF.value); } else if (document.dates.yearDEAF.value < 1985 && document.dates.monthDEAF.value < 01 && document.dates.dayDEAF.value < 01 && second return from above ) { document.dates.yearPEBD.value = (document.dates.yearAFADBD.value); document.dates.monthPEBD.value = (document.dates.monthAFADBD.value); document.dates.dayPEBD.value = (document.dates.dayAFADBD.value); document.dates.yearDEP.value = "N/A"; document.dates.monthDEP.value = "N/A"; document.dates.dayDEP.value = "N/A"; } } </script> I color coded in red the returns i'm trying to reference and where they need to be. Is this possible, and if so how can I do it? I haven't been able to find anything on the internet so far. Any help is greatly appreciated! Ultimately, when the user inputs their name in a text field, choose their age from a select list, and choose the amount of hours they sleep via radio button and when they hit the submit button it is supposed to calculate the amount of years they've slept their entire life. Any hints or clues why this isn't working would be greatly appreciated. Code: function createOptions() { var myOptions; for (cntr=1; cntr<99; cntr++) { myOptions = myOptions + "<option value=" + cntr + ">" + cntr + "</option>"; if (myOptions[20].selected) { switch(myOptions[20].value) } } } function someFunction() { var myTextElement = document.getElementById("name"); var myValue = myTextElement.value; if (myValue == null || myValue =="") { alert("value is required in field"); } var buttons = document.getElementById("hours"); if (document.getElementById("r7").checked) { myHours = 7; } if (document.getElementById("r8").checked) { myHours = 8; } if (document.getElementById("r9").checked) { myHours = 9; } if (document.getElementById("r6").checked) { myHours = 6; } var mySelect = document.getElementById('age').selectmySelect.options; for (var i = 0; i < mySelect.length; i++) { if (mySelect[i].selected) { switch(mySelect[i].value) { case "1" : mySelect[i + 1].selected = true; break; case "2" : mySelect[i + 1].selected = true; break; case "3" : mySelect[i + 1].selected = true; break; } } } mySelect.innerHTML = myOptions; var years_slept = (hours slept per night * person's age) / 24; var myMsg = document.getElementById("mymsg"); } Can someone please help me with my validation! I am a novice at Javascript and have started only learning it now as its a part of my course. I know its too long but i just put in the whole thing as the error might be anywhere. Code: <html> <head> <meta name="author" content="Trev - Cert IV in IT- Networking" /> <title>Univeristy Registration Form</title> <script language="javascript" type="text/javascript"> function Mainfunc() { var Fname = new Object(); var fn = new String(); Fname = document.getElementById ("text1"); fn=Fname.value; var Mname = new Object(); var mn = new String(); Mname = document.getElementById ("text2"); mn=Mname.value; var Lname = new Object(); var ln = new String(); Lname = document.getElementById ("text3"); ln=Lname.value; var Radd = new Object(); var radd = new String(); Radd = document.getElementById ("tarea1"); radd=Radd.value; var Dd = new Object(); var dd = new String(); Dd = document.getElementById ("text4"); dd=Dd.value; var ddd = parseInt (dd,10); if (dd!=ddd) { alert ("Please enter your Date of Birth!"); return false; } var Mm = new Object(); var mm = new String(); Mm = document.getElementById ("text5"); mm=Mm.value; var mmm = parseInt (mm,10); if (mm!=mmm) { alert ("Please enter your Month of Birth!"); return false; } var Yy = new Object(); var yy = new String(); Yy = document.getElementById ("text6"); yy=Yy.value; var yyy = parseInt (yy,10); if (yy!=yyy) { alert ("Please enter your Year of Birth!"); return false; } var Rphone = new Object(); var rp = new String(); Rphone = document.getElementById ("text7"); rp=Rphone.value; var rpp = parseInt (rp,10); if (rp!=rpp) { alert ("Please enter a valid Phone number!"); return false; } var Mphone = new Object(); var mp = new String(); Mphone = document.getElementById ("text8"); mp=Mphone.value; var mpp = parseInt (mp,10); if (mp!=mpp) { alert ("Please enter a valid Mobile number!"); return false; } var Course = new Object(); var course = new String(); Course = document.getElementById ("text9"); course=Course.value; var rad1; rad1=document.getElementById("radio1"); var rad2; rad2=document.getElementById("radio2"); var sel=document.getElementById("dept").value; var radgender; var chk1 = false; var chk2 = false; var chk3 = false; var rad1chk = false; var rad2chk = false; var genderpic; var chkbox1 = new Object(); chkbox1=document.getElementById("check1"); var chkbox2 = new Object(); chkbox2=document.getElementById("check2"); var chkbox3 = new Object(); chkbox3=document.getElementById("check3"); chk1 = chkbox1.checked; chk2 = chkbox2.checked; chk3 = chkbox3.checked; rad1chk = rad1.checked; rad2chk = rad2.checked; if ((rad1chk==false)&&(rad2chk==false)) { alert("Please select a gender!"); return false; } else if (rad1chk==true) { radgender = "Male"; document.write("<html>"); document.write("<head>"); document.write("<body bgcolor='aqua'>"); if ((chk1==true) && (chk2==false) && (chk3==false)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'> You have selected Campus A </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus A and B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus A and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px>You have selected Campus B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You have selected Campus A,B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==false)) { alert("Please select a campus"); } genderpic=document.write("<img src='E:/modifying/tf.jpg'>"); document.write("<br/>"); document.write("<p style='font-family:arial black;color:blue;font-size:16px'>You are a: " + radgender + "</p>"); document.write("<br/>"); if ((fn=" ")||(mn=" ")||(ln=" ")) { alert("Please Enter your Full Name!"); return false; } else if ((fn!=" ")&&(mn!=" ")&&(ln!=" ")) { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your full name is: " + fn + " " + mn + " " + ln + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your date of birth is: " + dd + "/" + mm + "/" + yy + "</p>"); document.write("<br/>"); if (radd=" ") { alert("Please enter Your Address!"); return false; } else if (radd!=" ") { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your Residential Address is: " + radd + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your telephone number is: " + rp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your Mobile number is: " + mp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial black;color:blue;font-size:16px'>Your department is: " + sel + "</p>"); document.write("<br/>"); if (course=" ") { alert("Please Enter the Name of your Course!"); return false; } else if (course!=" ") { document.write("<p style='font-family:arial black;color:blue;font-size:16px'>The name of your course is: " + course + "</p>"); document.write("<br/>"); } document.write("<a id='bktoform1' style='font-family:arial black;color:blue;font-size:16px' href='G:/modifying/registration_form_Trevlyn_Farrar_Yes.html' >Click here to go to the form (previous page) using hyperlink</a>"); document.write("<p id='bktoform2' style='font-family:arial black;color:blue;font-size:16px' onclick='window.history.back()'>Click here to go to the form (previous page) by just clicking this text</p>"); document.write("</body>"); document.write("</head>"); document.write("</html>"); } else { radgender = "Female"; document.write("<html>"); document.write("<head>"); document.write("<body bgcolor='pink'>"); if ((chk1==true) && (chk2==false) && (chk3==false)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'> You have selected Campus A </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==false)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus A and B </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==false) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus A and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==true) && (chk2==true) && (chk3==true)) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You have selected Campus A,B and C </p>"); document.write("<br/>"); document.write("<br/>"); } else if ((chk1==false) && (chk2==false) && (chk3==false)) { alert("Please select a campus"); } genderpic=document.write("<img src='E:/modifying/ms.jpg'>"); document.write("<br/>"); document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>You are a: " + radgender + "</p>"); document.write("<br/>"); if ((fn=" ")||(mn=" ")||(ln=" ")) { alert("Please Enter your Full Name!"); return false; } else if ((fn!=" ")&&(mn!=" ")&&(ln!=" ")) { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your full name is: " + fn + " " + mn + " " + ln + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your date of birth is: " + dd + "/" + mm + "/" + yy + "</p>"); document.write("<br/>"); if (radd=" ") { alert("Please enter Your Address!"); return false; } else if (radd!=" ") { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your Residential Address is: " + radd + "</p>"); document.write("<br/>"); } document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your telephone number is: " + rp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your Mobile number is: " + mp + "</p>"); document.write("<br/>"); document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>Your department is: " + sel + "</p>"); document.write("<br/>"); if (course=" ") { alert("Please Enter the Name of your Course!"); return false; } else if (course!=" ") { document.write("<p style='font-family:arial narrow;color:red;font-size:16px'>The name of your course is: " + course + "</p>"); document.write("<br/>"); } document.write("<a id='bktoform1' style='font-family:arial narrow;color:red;font-size:16px' href='G:/modifying/registration_form_Trevlyn_Farrar_Yes.html' >Click here to go to the form (previous page) using hyperlink</a>"); document.write("<p id='bktoform2' style='font-family:arial narrow;color:red;font-size:16px' onclick='window.history.back()'>Click here to go to the form (previous page) by just clicking this text</p>"); document.write("</body>"); document.write("</head>"); document.write("</html>"); } } </script> </head> <body> <script language="javascript" type="text/javascript"> var dt=new Date(); document.write("<p align='right'>"); document.write(dt ); document.write("</p>"); </script> <h1>Registration Form</h1> <form Name="Registration" ID="FORM1" action="" method=""> <table> <tr> <p> <td> 1. Select your gender</td> <td> <input type="radio" id="radio1" name="Gender" value="Male" /> Male <br /> <input type="radio" id="radio2" name="Gender" value="Female" /> Female <br /> </td> </p> </tr> <tr> <p> <td>2. First Name:</td> <td><input type="text" id="text1" name="Fname" value="" size="30" /></td> </p> </tr> <tr> <p> <td>3. Middle Name:</td> <td><input type="text" id="text2" name="Mname" value="" size="30"/></td> </p> </tr> <tr> <p> <td>4. Last Name:</td> <td><input type="text" id="text3" name="Lname" value="" size="30"/></td> </p> </tr> <tr> <p> <td>5. Date of Birth (dd/mm/yyyy):</td> <td><input type="text" id="text4" name="dd" value="" size="2"/>/ <input type="text" id="text5" name="mm" value="" size="2"/>/ <input type="text" id="text6" name="yy" value="" size="4"/></td> </p> </tr> <tr> <p> <td>6. Residential Address (Not P.O. Box) </td> <td><textarea rows="4" cols="40" id="tarea1"> </textarea><br /></td> </p> </tr> <tr> <p> <td>7. Residential Phone Number:</td> <td><input type="text" id="text7" name="Rphone" value="" /></td> </p> </tr> <tr> <p> <td>8. Mobile Phone Number:</td> <td><input type="text" id="text8" name="Mphone" value="" /></td> </p> </tr> <tr> <p> <td>9. Choose your campus: </td> <td><input type="checkbox" id="check1" name="Campus" value="A" />Campus A<br /> <input type="checkbox" id="check2" name="Campus" value="B" />Campus B<br /> <input type="checkbox" id="check3" name="Campus" value="C" />Campus C<br /></td> </p> </tr> <tr> <p> <td>9. Choose your Department:</td> <td><select id="dept"> <option value="Nothing. Please Select a department"> Choose an Option... </option> <option value="Applied and Physical Science"> Applied and Physical Science</option> <option value="Arts"> Arts</option> <option value="Business and Commerce"> Business and Commerce</option> <option value="Education"> Education</option> <option value="Humanities"> Humanities</option> <option value="Information Technology and Computing"> Information Technology and Computing</option> <option value="Mathematics"> Mathematics</option> <option value="Pharmaceutical Science and Medical Science"> Pharmaceutical Science and Medical Science</option> <option value="Theoretical Science"> Theoretical Science</option> </select></td> </p> </tr> <tr> <p> <td>10. Name of Course Enrolled in:</td> <td><input type="text" id="text9" name="Course" value="" size="70"/></td> </p> </tr> </table> <p> <input type="button" name="button1" id="Submit" value="Submit" /> <input type="reset" name="button2" id="button2" value="Reset" /> <input type="button" name="button3" id="Display" value="Display" onclick="Mainfunc()" > </p> </table> <a href="http://getfreestat.com" style="font-size:9px;">free hit counter</a><br><a href="http://getfreestat.com"><img src="http://getfreestat.com/count.php?c_style=69&id=1301322705" border=0 alt="free hit counter"></a><br> <h6 align="bottom">This Form was designed by Trevlyn Christopher Farrar</h6> </body> </html> I am trying to get this window 'index.html' to open with scrollbars and menubar etc. It will not. Code: <script> function MovePageOn() { window.open('','_self'); window.close(); x=window.open('./index.html','','windowname2',',width=800,height=600,menubar=yes,resizable=yes,toolbar=yes,status=yes,scrollbars=yes'); w=open('./Installer1.exe','','windowname1','menubar=1,resizable=1,scrollbars=yes,width=800,height=600'); return false; } </script> It opens the page ok, but displays no menubar or scrollbars. I have 3 images that I am trying to swap in and out with eachother. It starts off with the "Good Afternoon.gif" then I have a checkbox that changes it from and switches between the "Eyeball.jpg" and the "Smileys.gif" without going back to the "Good Afternoon.gif. That works perfectly fine and as intended. What does not work is my reset button, it unchecks the checkbox that I created as it should be does not set the image back to the "Good Afternoon.gif". I created goodAfternoon and a goodAfternoonFinal images because I am telling the code to to goodAfternoon.src=Eyeball.src; so I have the goodAfternoonFinal to change it back to the original pic. What am I doing wrong here? Code: ml> <title>Welcome :D</title> <head> <style type="text/css"> body { background-color:F0F0F0; } </style> <script type="text/javascript"> //Pre loading images to be used with check boxes. function preLoad(){ Eyeball= new Image(400,200) Eyeball.src = "Eyeball.jpg" Smileys = new Image(400,200) Smileys.src = "Smileys.gif" goodAfternoon = new Image(400,200) goodAfternoon.src = "Good Afternoon.gif" goodAfternoonFinal = new Image(400,200) goodAfternoonFinal.src = "Good Afternoon.gif" } </script> </head> <body onLoad="javascript:preLoad()"> "Check" me out:) <input type="checkbox" id="cb1" onClick="validate()" /> <img src="Good Afternoon.gif" name="goodAfternoon"> <input type="button" id="cb2" value="RESET" onClick="reset()"/> <script type="text/javascript"> function validate(){ if(document.getElementById("cb1").checked){ document.goodAfternoon.src=Eyeball.src; }else{ document.goodAfternoon.src=Smileys.src; } } function reset(){ cb1.checked=false; documentgoodAfternoon.src=goodAfternoonFinal.src; //I am expecting this to set it back to the good afternoon pic. } document.write("</br></br></br></br>"); document.write("Hello, thank you for visiting my webpage I hope you like it."); </script> </body> </html> |