JavaScript - Drop-down And Javascript Not Working As Expected
Here is my code for drop down list
<Select Name=YearSel> <Option selected> <% SQLQUERY= "select Year from YearTable where ID = '"&id&"' " Set list=conn.execute(SQLQUERY) Do While Not list.EOF YearSel=list("Year") Response.Write "<OPTION>" & YearSel list.MoveNext Loop %> </SELECT> <INPUT TYPE="Submit" VALUE="Go" ONCLICK="go()" id=SUBMIT1 name=SUBMIT1> ......................................................................................... I have this java script in place for GO button above....but it always goes to else part function func1(){ if (document.form.YearSel.value > "2011") { document.form.action ="Test.asp"; document.form.method = "post"; document.form.submit(); } else { alert("alert else"); } } Where I am doing wrong....please help Similar TutorialsHello toggle div not working exactly as expected. What have I done wrong? please see this page (removed) click on About Us then in iframe click on the greyed out "Chinese" but don't move cursor ----- the div that now shows appears directly under the h2 heading. Now mouse out and the div drops to its correct position. (ie the position I think it should be in when it first shows) To see it again click on Contact Us. Why is it doing this? see iframe for code. (nothing in it so easy to see) any help much appreciated LT ps it toggles normally after the first click Hey everyone, I am normally very good at debugging these kinds of things but I've had a long day and am obviously overlooking something very, very simple. If anyone can spot it that would be fantastic. JavaScript Code: <script type="text/javascript"> function toggle (id) { if (document.getElementById('sub_' + id).style.display == 'none') { document.getElementById('sub_' + id).style.display = ''; document.getElementById('icon_' + id).src = 'images/collapse.gif'; } else { document.getElementById('sub_' + id).style.display = 'none'; document.getElementById('icon_' + id).src = 'images/expand.gif'; } } </script> HTML Code: <div id="sub_0"><div style="padding-left: 0px;"><img src="images/point.gif"> Biology</div> <div style="padding-left: 0px;"><img src="images/point.gif"> <a href="products.php?cid=4">Chemistry</a></div> <div style="padding-left: 0px;"><img src="images/point.gif"> <a href="products.php?cid=5">Earth/Space</a></div> <div style="padding-left: 0px;"><img src="images/expand.gif" id="icon_6" onclick="javascript:toggle('6');" title="Click to Expand/Collapse"> <a href="products.php?cid=6">Physics</a></div> <div id="sub_6" style="display: none;"><div style="padding-left: 10px;"><img src="images/point.gif"> <a href="products.php?cid=10">Kinimatics</a></div> <div style="padding-left: 10px;"><img src="images/expand.gif" id="icon_12" onclick="javascript:toggle('12');" title="Click to Expand/Collapse"> <a href="products.php?cid=12">Dynamics</a></div> <div id="sub_12" style="display: none;"><div style="padding-left: 20px;"><img src="images/point.gif"> <a href="products.php?cid=11">Newton's Laws</a></div> <div style="padding-left: 20px;"><img src="images/point.gif"> <a href="products.php?cid=13">Special Forces</a></div> <div style="padding-left: 20px;"><img src="images/expand.gif" id="icon_14" onclick="javascript:toggle('14');" title="Click to Expand/Collapse"> <a href="products.php?cid=14">Momentum</a></div> <div id="sub_14" style="display: none;"><div style="padding-left: 30px;"><img src="images/point.gif"> <a href="products.php?cid=15">Impulse</a></div> </div></div><div style="padding-left: 10px;"><img src="images/expand.gif" id="icon_16" onclick="javascript:toggle('16');" title="Click to Expand/Collapse"> <a href="products.php?cid=16">Energy</a></div> <div id="sub_16" style="display: none;"><div style="padding-left: 20px;"><img src="images/point.gif"> <a href="products.php?cid=17">Collisions</a></div> </div><div style="padding-left: 10px;"><img src="images/point.gif"> <a href="products.php?cid=21">Waves</a></div> <div style="padding-left: 10px;"><img src="images/expand.gif" id="icon_18" onclick="javascript:toggle('18');" title="Click to Expand/Collapse"> <a href="products.php?cid=18">Optics</a></div> <div id="sub_18" style="display: none;"><div style="padding-left: 20px;"><img src="images/point.gif"> <a href="products.php?cid=19">Mirrors</a></div> <div style="padding-left: 20px;"><img src="images/point.gif"> <a href="products.php?cid=20">Lenses</a></div> </div></div><div style="padding-left: 0px;"><img src="images/point.gif"> <a href="products.php?cid=2">Mathematics</a></div> <div style="padding-left: 0px;"><img src="images/point.gif"> <a href="products.php?cid=7">Fine Arts</a></div> </div> </div> Expected Result: The icon changes to expand or collapse based on the visibility of the following <div>. Actual Result: Shows content and changes icon to collapse but when clicking on the collapse icon the <div> does not disappear and the icon just disappears in IE. In firefox clicking on the expand icon simply causes the icon to disappear. You can view what is happening he http://www.onacd.ca/products.php It is the navigation on the left. I'm going to continue to try and figure it out - but any suggestions would be great. I'm dying here. Perhaps I need a nap. Luke Can somebody please explain why when the lines of code that are commented out are reintroduced that this code breaks instead of resulting in each of the four circles being a different color? Code: <!DOCTYPE HTML> <html> <head><title>Circles</title></head> <body> <canvas id="myCanvas" width="512" height="128" style="border:1px solid #c3c3c3;"> Your browser does not support the canvas element. </canvas> <script type="text/javascript"> var i=0; var axisX=128; var axisY=64; var radius=56; //var colors=[red, green, blue, yellow]; //var currentColor; function drawCircle(){ //currentColor=colors[i]; var c=document.getElementById("myCanvas"); var cxt=c.getContext("2d"); //cxt.fillStyle=currentColor; cxt.strokeStyle="black"; cxt.beginPath(); cxt.arc(axisX,axisY,radius,0,Math.PI*2,true); cxt.closePath(); cxt.fill(); cxt.stroke(); } for (i=0;i<4;i++){ drawCircle(); axisX=axisX+84; } </script> </body> </html> What am I doing wrong? Thank you! I have a problem when changing images and image maps with mouseover and click events in IE. Firefox, Chrome and Safari all work well but IE does not. It's hard to describe but when I mouse over a hot spot the image changes and then right away changes back. you can see it here: here is the Javascript code: Code: var current_overID = ""; var last_overID = ""; function item (img_name,width,height) { img_prefix = img_name; this.slide_img = new Image (width,height); this.slide_img.src = "http://www.dsisyr.com/images/stories/DeltaV/" + img_prefix + ".jpg"; } function new_item (img_name,width,height) { item [img_name] = new item (img_name,width,height); } function mouseover (itemID, mapID) { current_overID = itemID; if (current_overID != last_overID) { document.deltavmap.src = item [current_overID].slide_img.src; document.deltavmap.useMap=mapID; } } new_item ("DSI-DeltaV1",700,300); new_item ("DSI-DeltaV1-2-1",700,300); new_item ("DSI-DeltaV1-2-2",700,300); .....many more <MAP NAME="deltav"> <AREA SHAPE="RECT" COORDS="27,27,219,53" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-2-1', '#eng')" window.defaultStatus='' window.status='Engineering' return true > <AREA SHAPE="RECT" COORDS="27,74,171,97" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-3-1', '#sw')" window.defaultStatus='' window.status='Software'; return true > <AREA SHAPE="RECT" COORDS="27,122,270,145" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-4-1', '#doc')" window.defaultStatus='' window.status='Documentation'; return true > <AREA SHAPE="RECT" COORDS="27,167,156,195" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-5-1', '#sup')" window.defaultStatus='' window.status='Support'; return true > <AREA SHAPE="DEFAULT" NOHREF> </MAP> <MAP NAME="eng"> <AREA SHAPE="RECT" COORDS="38,52,244,75" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-2-1', '#eng') " window.defaultStatus='' window.status='Batch Processing' return true > <AREA SHAPE="RECT" COORDS="40,82,230,103" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-2-2', '#eng')" window.defaultStatus='' window.status='Control Modules' return true > <AREA SHAPE="RECT" COORDS="40,112,143,136" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-2-3', '#eng')" window.defaultStatus='' window.status='Graphics' return true > <AREA SHAPE="RECT" COORDS="40,141,176,168" HREF="#" Onmouseover="mouseover('DSI-DeltaV1-2-4', '#eng')" window.defaultStatus='' window.status='ProtoTyping' return true > <AREA SHAPE="RECT" COORDS="24,224,84,234" HREF="#" OnClick="mouseover('DSI-DeltaV1-3-1', '#sw')" window.defaultStatus='' window.status='Software' return true > <AREA SHAPE="RECT" COORDS="24,236,124,247" HREF="#" OnClick="mouseover('DSI-DeltaV1-4-1', '#doc')" window.defaultStatus='' window.status='Documentation' return true > <AREA SHAPE="RECT" COORDS="25,248,76,261" HREF="#" OnClick="mouseover('DSI-DeltaV1-5-1', '#sup')" window.defaultStatus='' window.status='Support' return true > <AREA SHAPE="RECT" COORDS="620,240,699,399" HREF="#" OnClick="mouseover('DSI-DeltaV1', '#deltav')" window.defaultStatus='' window.status='deltav'; return true > <AREA SHAPE="DEFAULT" NOHREF> </MAP> ... many others Can any one tell me what i need to do to fix this in IE? Thanks! Fayette Hi, I have created a global navigation includes document. Unfortunately the drop down menus that are part of the navigation aren't working. They worked fine when they were part of the page, but now that they are separated from the page as includes the drop down menus don't appear in my test site (posted to a web server). All other content in the includes file appears and works. Any ideas? Thanks for your help. Hi - in editing a website...this javascript html is really getting on my nerves - can somebody please tell me why i keep getting the error message expected ")" when i try this code: (which ive fiddled around with bloody loads to try and resolve!) <SCRIPT LANGUAGE=JAVASCRIPT > var r_text = new Array (); r_text[0] = Text 0; r_text[1] = Text 1; r_text[2] = Text 2; var i = Math.floor(3*Math.random()); { document.write("<marquee style="font-family: 'Georgia'; color: #FFFF00; font-size: 13pt; mso-fareast-font-family: 'Arial'" ><scrollamount="15"><b>" + r_text[i] + "</b></scrollamount></marquee>"); } it seems fine to me and is getting me really frustrated now any help greatly appreciated, do whatever you like to the coding if itll work! thankyou very much, joe. Thanks for looking, I am a novice. Desi Drop down menu that works with IE7 & 8 Works with: MSIE6? andversions (that I have checked) of FF, Safari, Safari for iPhone Page: http://sfphotography.com/menu/test.html All files: http://sfphotography.com/menu/ Note, there are no linked pages, IE7 does not even show the option for selecting pages. [code=html] <script type="text/javascript" src="drop_down.js"></script> <style type="text/css"> @import url(style2.css); </style> <body text="black" bgcolor="white" link="#a50921" vlink="#767676" background=""> <div align="center"> <ul><font size="2"> <li><a href="#">Rooms</a> <ul> <li><a href="queen.html">2 Queen / King</a></li> <li><a href="family.html">Family Suite</a></li> <li><a href="jacuzzi.html">Jacuzzi Suite</a></li> </ul> </li> <li><a href="#">Rates</a> <ul> <li><a href="queen_.html">2 Queen / King</a></li> <li><a href="family_.html">Family Suite</a></li> <li><a href="jacuzzi_.html">Jacuzzi Suite</a></li> </ul> </li> </font> </ul> [/code] [code=javascript] // JavaScript Document startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; [/code] [code=CSS] body { font: normal 11px verdana; } ul { margin: 0; padding: 0; list-style: none; width: 150px; /* Width of Menu Items */ border-bottom: 1px solid #ccc; } ul li { position: relative; } li ul { position: absolute; left: 149px; /* Set 1px less than menu width */ top: 0; display: none; } /* Styles for Menu Items */ ul li a { display: block; text-decoration: none; color: #777; background: #fff; /* IE6 Bug */ padding: 5px; border: 1px solid #ccc; border-bottom: 0; } /* Fix IE. Hide from IE Mac \*/ * html ul li { float: left; height: 1%; } * html ul li a { height: 1%; } /* End */ ul li a:hover { color: #a50921; background: #f9f9f9; } /* Hover Styles */ li ul li a { padding: 2px 5px; } /* Sub Menu Styles */ li:hover ul, li.over ul { display: block; } /* The magic */ [/code] I'm was working on show and hide drop down menu and this works fine on IE, Google Chrome, Safari but not firefox. Can anyone explain to me one this is? Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title></title> <script type="text/javascript"> var timeout = 500; var closetimer = 0; function mopen(eid) { //cancel the timer cancelTimer(); //if there is a existing menu close it if(menu) menu.style.display='none'; //now go about opening the current one var menu = document.getElementById(eid); menu.style.display='block'; } function mclose() { menu.style.display='none'; } function startTimer() { closetimer = window.setTimeout(mclose, timeout); } function cancelTimer() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } </script> <style type="text/css"> body,html { background:#2E2D3B; font-family:Arial; font-size:0.9em; } div#menu { width:120px; height:auto; display:none; border-top:1px solid #cccccc; border-right:1px solid #cccccc; border-left:1px solid #cccccc; overflow:hidden; position:relative; top:3px; } a { color:#f1f1f1; text-decoration:none; } a:hover { text-decoration:underline; } #menu a { color:#111111; text-decoration:none; } #menu a:hover { color:#FF0000; } #menu ul { margin: 0; padding: 0; } #menu li { list-style:none; list-style-position:inside; list-style-type:none; padding:5px; background:#ffffff; border-bottom:1px solid #cccccc; } #menu li:hover { background:#f1f1f1; } </style> </head> <body> <a href="javascript:;" onmouseover="mopen('menu');" onmouseout="startTimer();">Show Menu</a> <div id="menu"> <ul onmouseover="cancelTimer();" onmouseout="startTimer();"> <li><a href="#">Page</a></li> <li><a href="#">Page 1</a></li> <li><a href="#">Page 2</a></li> <li><a href="#">Page 3</a></li> <li><a href="#">Page 4</a></li> <li><a href="#">Page 5</a></li> </ul> </div> </body> </html> And you can view it he http://idigteck.com Thanks, Jon W I hope I have this post in the right place! Any help would be very much appreciated... I have a feature on my website that allows users to choose the website background (using alternate css sheets) and then uses an externally linked javascript file to store the background choice as a cookie so it is consistent throughout the website. This works perfectly locally (i.e. when previewing my website on my computer) but now it is uploaded to my host it doesn't appear to be working. (with the same browser) My javascript is he http://www. b r p - e n v .com/javascript/backgroundchange.js (with no spaces) The website that the javascript file is linked to is http://www. b r p - e n v .com (with no spaces) In the head I have: <script type="text/javascript" src="../javascript/backgroundchange.js"></script> ...then I have: <body onload="set_style_from_cookie()"> ...and for users to choose which background: <form> <input type="image" src="../images/white-background-thumb.jpg" onclick="switch_style('bg1');return false;" name="theme" value="White" id="bg1"> etc... </form> My problem is: The background reverts back to the default when moving to a different page. This would indicate that the background choice is not being saved in cookies. But this works locally! I have tried putting the javascript directly onto each page but I still had the same problem. I hope someone can help, I will be so grateful if I can get this to work. Many thanks indeed! I thought I was so cool combining both this shopping cart with the double drop down menu, but now my menu isnt working and I can't seem to trouble shoot my way through it anymore. I am sure I am missing just one small part because the page loads fine, but when I select an option from step three where it says "select a subject" it no longer loads the options into the subsequent drop down menu which reads "Pages appear here" (LoL at least I WISH they would appear there) Here is the code. I apologize for not making it smaller, but as I mentioned it is meshed with a shopping cart and I am not skilled enough to seperate my code. Code: <head> <script language="javascript"> <!--// //new Option("text","value") //this code changes menus function nullOptionsDMA(aMenu){ var tot=aMenu.options.length for (i=0;i<tot;i++) { aMenu.options[i]=null } aMenu.options.length=0; } function MySubjectDMA0(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Drink Low/No Alcohol Beer","295"); options[2]=new Option("Drink Mixed Drinks","295"); options[3]=new Option("Buy Chewing Tobacco","295"); options[0].selected=true } } function MySubjectDMA1(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Buy Fine Jewelry,<$400","295"); options[2]=new Option("Buy Aerobic/Fitness Shoes, $50+","295"); options[3]=new Option("Dry Cleaning,$100+","295"); options[0].selected=true } } function MySubjectDMA2(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Lease Most Recent Vehicle","295"); options[2]=new Option("Own/Lease New Vehicle","295"); options[3]=new Option("Own/Lease Used Vehicle","295"); options[0].selected=true } } function MySubjectDMA3(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Has Satellite Dish","295"); options[2]=new Option("Watch Any Pay-per-View","100"); options[0].selected=true } } function MySubjectDMA4(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Own Camcorder","295"); options[2]=new Option("Buy Any TV","295"); options[3]=new Option("Own 3+ Television Sets","295"); options[0].selected=true } } function MySubjectDMA5(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Has Any Homeowner/Per Pr Insurance","295"); options[2]=new Option("Has Auto","295"); options[3]=new Option("Has Disability Insurance","295"); options[0].selected=true } } function MySubjectDMA6(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Grocery Shop,4+ Times 1wk","295"); options[2]=new Option("Grocery Store, Travel 11+ Miles ","295"); options[0].selected=true } } function MySubjectDMA7(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Buy Health/Beauty Products for Women,$100+","295"); options[2]=new Option("Go to the Doctor for Check-Ups","295"); options[3]=new Option("Use Hair Growth Products","295"); options[0].selected=true } } function MySubjectDMA8(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Buy from Fast Food","295"); options[2]=new Option("Dine Out,1+ Times/wk","295"); options[3]=new Option("Dine Out,<1 Times/mo","295"); options[0].selected=true } } function MySubjectDMA9(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Belong to a Church Board ","295"); options[2]=new Option("Belong to a Country Club ","100"); options[3]=new Option("Buy Any Children's Toys","295"); options[0].selected=true } } function MySubjectDMA10(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Average Monthly Cell Phone Bill,$100+","295"); options[2]=new Option("Own Cell Phone ","295"); options[3]=new Option("Has Cell Phone for Business Use ","295"); options[0].selected=true } } function MySubjectDMA11(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","0"); options[1]=new Option("Ads Keep Me Up-to-Date about Prods/Svcs I Want","295"); options[2]=new Option("Buy Based on Quality, Not Price","295"); options[3]=new Option("Choose Store b/c Store Personnel Service","295"); options[0].selected=true } } function MySubjectDMA12(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","1650"); options[1]=new Option("Has Cooling Equipment, Heat Pump","1650"); options[2]=new Option("Has Heater System, Central Warm","1650"); options[3]=new Option("Has Heater System, Heat Pump ","1650"); options[0].selected=true } } function MySubjectDMA13(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","1650"); options[1]=new Option("Has Online Game Download Sub","1650"); options[2]=new Option("Has Online Movie Download Sub","1650"); options[3]=new Option("Has Online","1650"); options[0].selected=true } } /* ####################### setUp100 ####################### */ function setUpDMA(){ with (document.orderform) { if (menuSubjectsDMA.selectedIndex==0){ menuSubjectsDMA.options[0].selected=true qty4.options[0].selected=true } if (menuSubjectsDMA.selectedIndex==1) MySubjectDMA0(qty4) if (menuSubjectsDMA.selectedIndex==2) MySubjectDMA1(qty4) if (menuSubjectsDMA.selectedIndex==3) MySubjectDMA2(qty4) if (menuSubjectsDMA.selectedIndex==4) MySubjectDMA3(qty4) if (menuSubjectsDMA.selectedIndex==5) MySubjectDMA4(qty4) if (menuSubjectsDMA.selectedIndex==6) MySubjectDMA5(qty4) if (menuSubjectsDMA.selectedIndex==7) MySubjectDMA6(qty4) if (menuSubjectsDMA.selectedIndex==8) MySubjectDMA7(qty4) if (menuSubjectsDMA.selectedIndex==9) MySubjectDMA8(qty4) if (menuSubjectsDMA.selectedIndex==10) MySubjectDMA9(qty4) if (menuSubjectsDMA.selectedIndex==11) MySubjectDMA10(qty4) if (menuSubjectsDMA.selectedIndex==12) MySubjectDMA11(qty4) if (menuSubjectsDMA.selectedIndex==13) MySubjectDMA12(qty4) if (menuSubjectsDMA.selectedIndex==14) MySubjectDMA13(qty4) } } /* ####################### changeFiles ####################### */ function changeFilesDMA(){ aMenu=document.orderform.menuSubjectsDMA aMenu2=document.orderform.qty4 with (aMenu){ switch (selectedIndex) { case 0: aMenu2.options.length=0; aMenu2.options[0]= new Option("Pages appear here","0") aMenu2.options[0].selected=true; history.go(0) break case 1: MySubjectDMA0(aMenu2) aMenu2.options[0].text="Drink Any Beer" break case 2: MySubjectDMA1(aMenu2) aMenu2.options[0].text="Buy Costume Jewelry" break case 3: MySubjectDMA2(aMenu2) aMenu2.options[0].text="Bought Most Recent Vehicle" break case 4: MySubjectDMA3(aMenu2) aMenu2.options[0].text="Subscribe to Cable TV" break case 5: MySubjectDMA4(aMenu2) aMenu2.options[0].text="Buy Camera" break case 6: MySubjectDMA5(aMenu2) aMenu2.options[0].text="Has Any Credit Card" break case 7: MySubjectDMA6(aMenu2) aMenu2.options[0].text="Grocery Shopping spend $150+ 1wk" break case 8: MySubjectDMA7(aMenu2) aMenu2.options[0].text="Buy Health/Beauty Products for Men,$100+" break case 9: MySubjectDMA8(aMenu2) aMenu2.options[0].text="Buy from Any Fast Food Restaurant" break case 10: MySubjectDMA9(aMenu2) aMenu2.options[0].text="Attend Classical/Opera perform.,1+ Times/mo" break case 11: MySubjectDMA10(aMenu2) aMenu2.options[0].text="Average Monthly Cell Phone Bill,<$26" break case 12: MySubjectDMA11(aMenu2) aMenu2.options[0].text="Ads Are More Manipulative Than Informative100" break case 13: MySubjectDMA12(aMenu2) aMenu2.options[0].text="Has Cooling Equipment, Central Air" break case 14: MySubjectDMA13(aMenu2) aMenu2.options[0].text="Has Wireless home network" break } } } //--> </script> <!-- ######## end copying code (DMA) from the HEAD ####### --> <script> <!-- function wopen(url, name, w, h) { // Fudge factors for window decoration space. // In my tests these work well on all platforms & browsers. w += 32; h += 96; var win = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no'); win.resizeTo(w, h); win.focus(); } // --> </script> <SCRIPT SRC="language-en.js"></SCRIPT> <SCRIPT SRC="nopcart.js"> </SCRIPT> <link rel="stylesheet" type="text/css" href="main.css"> </head> <BODY> <table class="Global" cellpadding="0" cellspacing="0" border="0"> <tr><td height="117" colspan="2"> <!-- ============ Navbar Menu ============== --> <table class="NavBar" style="height: 27px;" cellspacing="0" border="0"><tr><td> <table class="NavBarMenu" style="height: 27px;" align="left" border="0" cellspacing="0"><tr> <td><a href="index.html">Home</a> </td> <td><a href="samples.html">Samples</a> </td> <td><a href="ordering.html">Ordering</a> </td> <td><a href="faq.html">F.A.Q.</a> </td> <td><a href="contact.html">Contact</a></td> </tr></table> </td></tr></table> <div style="height: 1px; background: #000000;"><img src="images/space1x1.gif" width="1" height="1" alt="spacer"></div> <noscript> <p style="color:red">You appear to have Javascript disabled. This page requires Javascript. Please <a href="http://support.microsoft.com/gp/howtoscript" target="_blank">enable Javascript</a> and reload this page before continuing.</p> </noscript> <script language="JavaScript"> <!-- function CalculateTotals(){ f=document.orderform; f.total1.value=parseInt(f.qty1.value)*50; f.total2.value=parseInt(f.qty2.value)*((f.qty1.value)*10+10); f.total3.value=parseInt(f.qty3.value)*100; f.total4.value=parseInt(f.qty4.value)*1.2; f.grandtotal.value=parseInt(f.total1.value) +parseInt(f.total2.value) +parseInt(f.total3.value) +parseInt(f.total4.value) +parseInt(f.sh.value);} //--> </script></head> <body> <form name="orderform" method="post" action="formprocessor"> <table border="1" width="100%" cellpadding="4"><tr> <td colspan="2" align="center"><b>Step 1: Select what to include in your report</b><br><i>My report should...</i></td></tr> <tr><td> Evaluate a radius of <select name="qty1" onchange="CalculateTotals()"> <option Selected value="0">5 miles <option value="1">10 miles <option value="2">15 miles <option value="3">20 miles </select> around <INPUT TYPE="text" NAME="Location" VALUE="Full Address OR Zipcode" SIZE="22" MAXLENGTH="45"> </td> <td align="right"><input name="total1" size="7" OnFocus="document.orderform.qty2.select(); document.orderform.qty2.focus();" /></td></tr> <tr><td> <select name="qty2" onchange="CalculateTotals()"> <option Selected value="0">No <option value="1">Yes </select> Include competitive analysis (<a href="whatis1.html" target="popup" onClick="wopen('whatis1.html', 'popup', 350, 450); return false;">what is this?</a>) </td> <td align="right"><input name="total2" size="7" OnFocus="document.orderform.qty3.select(); document.orderform.qty3.focus();" /></td></tr> <tr><td> <select name="qty3" onchange="CalculateTotals()"> <option Selected value="0">No <option value="1">Yes </select> Include target market report (<a href="whatis2.html" target="popup" onClick="wopen('whatis2.html', 'popup', 350, 450); return false;">what is this?</a>) </td> <td align="right"><input name="total3" size="7" OnFocus="document.orderform.qty4.select(); document.orderform.qty4.focus();" /></td></tr> </table><br><table border="1" width="100%" cellpadding="4"> <tr><td colspan="4" align="center"> <b>Step 2: Define your target market</b><br><i>The people I am looking for are...</i></td></tr> <tr><td colspan="2"> Household Age</td><td colspan="2"> <select name="HHAge" onchange="CalculateTotals()"> <option Selected value="">Target Age <option value="Less than 35">Less than 35 <option value="Less than 100">Less than 55 <option value="25to44">25-44 </select> <tr><td colspan="2"> Average Household Education</td><td colspan="2"> <select name="HHEducation" onchange="CalculateTotals()"> <option Selected value="">Target Education <option value="GradPlus">Graduate Plus <option value="CollegeGrad">College Grad </select><br> <tr><td colspan="2"> Household Employment Type</td><td colspan="2"> <select name="HHEmployment" onchange="CalculateTotals()"> <option Selected value="">Target Employment <option value="Management">Management <option value="Professional">Professional </select><br> <tr><td colspan="2"> Household Ethnicity</td><td colspan="2"> <select name="HHEthnicity" onchange="CalculateTotals()"> <option Selected value="">Target Ethnicity <option value="White">White <option value="WhiteAsianMix">White, Asian, Mix </select><br> <tr><td colspan="2"> Household Composition</td><td colspan="2"> <select name="HHComposition" onchange="CalculateTotals()"> <option Selected value="">Target Age <option value="HHwithKids">Household with kids <option value="MostlywithKids">Mostly with kids </select><br> <tr><td colspan="2"> Household Income</td><td colspan="2"> <select name="HHIncome" onchange="CalculateTotals()"> <option Selected value="">Target Income <option value="Wealthy">Wealthy <option value="Upscale">Upscale <option value="UpperMiddle">Upper Middle <option value="Middle">Middle <option value="LowerMid">Lower Middle </select><br> <tr><td colspan="2"> Household Tenure</td><td colspan="2"> <select name="HHTenure" onchange="CalculateTotals()"> <option Selected value="">Target Tenure <option value="Homeowners">Homeowners <option value="Renters">Renters </select><br> </td></tr> </table><br><table border="1" width="100%" cellpadding="4"> <tr><td colspan="4" align="center"><b>Step 3: Add a specialty targeting criteria</b><br><i>I want people who...</i></td></tr><tr></td> <tr><td> <!-- This menu holds the subjects--> <select name="menuSubjectsDMA" onChange="changeFilesDMA()" size="1"> <option value="0">Select a subject <option value="">Alcohol & Tabacco $295 <option value="">Jewelry & Apparel $295 <option value="">Automotive $295 <option value="">TV Media $295 <option value="">Electronics & Internet $295 <option value="">Finance $295 <option value="">Grocery $295 <option value="">Health & Drugs $295 <option value="">Restaurants $295 <option value="">Sports & Leisure $295 <option value="">Telecommunications $295 <option value="">Consumer Behavior $295 <option value="">Home and Utilities $1980 <option value="">Home Technology $1980 </select> </td><td colspan="2"> <!-- this menu holds the files to go--> <select name="qty4" onChange="CalculateTotals()" style="width:200" size="1"> <option value="0">Pages appear here </select> <td align="right"><input name="total4" size="7" OnFocus="document.orderform.qty1.select(); document.orderform.qty1.focus();" /></td></tr> </td></tr> </table><br> <table border="1" width="100%" cellpadding="4"> <tr><td colspan="4" align="center"><b>Step 4: Tell us about your business</b><br><i>Customize my report for...</i></td></tr> <tr><td> <td align="right">Minimum Order:</td><td align="right">$200 </td></tr> <tr><td></td><td></td> <td align="right"><b>GRAND TOTAL:</b></td> <td align="right"><input name="grandtotal" size="7" OnFocus="document.orderform.qty1.select(); document.orderform.qty1.focus();" /></td></tr> </table> <input type="hidden" value="5" name="sh" /> <br /> <center><input type="reset" value="Reset Form"> <input type="submit" value="Proceed to Checkout"> </center> </form> <script language="JavaScript"> <!-- f=document.orderform; f.qty1.value=0; f.qty2.value=0; f.qty3.value=0; f.qty4.value=0; f.total1.value=0; f.total2.value=0; f.total3.value=0; f.total4.value=0; f.sh.value=200; f.grandtotal.value=200; //--> </script> </body></html> <!-- ======= End Content ======== --> </td></tr> <!-- ======== Footer ========== --> <tr><td colspan="2" class="Footer" style="vertical-align: middle;"> Copyright © GrowthEdge </td></tr></table> </body> </html> I also check my email regularly if anyone has any comments or advice. hereis the html file and javascripton click of this button a html ***************************** <table class=matcolor id=topnav cellspacing=0 cellpadding=0 width=550 border=0 bgcolor="#FFCCCC"> <tbody> <tr align=middle> <td id=menu1 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Desk Top Publishing </font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu2 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Transcription</font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu3 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Accounts Processing </font></div> </td> </tr> </tbody> </table> ***************************************** <script language=JavaScript> ix = document.getElementById('tblmenu1').getBoundingClientRect(); new ypSlideOutMenu("menu1", "right",ix.left + ix.right ,ix.bottom + 10); </script> **any thing i have to alter to work in firefox please help Hi developers Needing some help. My javascript/css drop down menu is not working on the ipad or other touch screen devices. It works fine on laptops & desktops which use a mouse. I've discovered that this is because touchscreen devices like the Ipad do not recognise the onmouseover/onmouseout event handler that my script relies on. Is there any way I can modify my script so that it is compatiable both with traditional devices and touchscreen devices? The code I am using is: <script type="text/javascript"><!-- var timeout = 500; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // close layer when click-out document.onclick = mclose; //--></script> Which drives the following html: <ul id="links"> <li><a href="whats_new/whats_new.html">what's new</a></li> <li><a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">clothing</a> <div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="clothing/clothing_page1.html">clothing</a> </div> </li> <li><a href="#" onmouseover="mopen('m2')" onmouseout="mclosetime()">accessories</a> <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="bags/bags_page1.html">bags</a> <a href="jewellery/jewellery_page1.html">jewellery</a> </div> </li> </ul> Any suggestions would be much appreciated. Thank you. Nonye Hi, I have the following code for drag and drop objects in any page. My target: I want to be able to drag and drop the advertisement images that come on top of the page. It works most of the time, but sometime page crashes. I use google chrome as a bookmarklet. Code: Code: javascript:var d=document,b=d.body,i="innerHTML",s="style",p="position",a="absolute",r="relative",w1="offsetWidth",w2="width",h1="offsetHeight",h2="height",t1="offsetTop",t2="top",l1="offsetLeft",l2="left",drag=false;function down(e){drag=true;z=event.srcElement;z[s][p]=r;x=event.clientX;y=event.clientY;zx=z[l1];zy=z[t1];d.onmousemove=move}function up(e){drag=false;}function move(e){if(drag){z[s][l2]=zx+event.clientX-x;z[s][t2]=zy+event.clientY-y}}document.onmousedown=down;document.onmouseup=up; Any improvements in the code is appreciated. Does anybody have a advanced better code, because I am just medium in javascript. Hi Guys, A couple of years ago I came across a Javascript drop down search facility which I used for an eBay shop I built. I don't really have any knowledge at all of Javascript but I did manage to get it to work the way I wanted, somehow! Basically at the moment with the drop down you have to select the product type, your make of vehicle and then your model. This then searches the ebay shop for any relevant listings. However, I now want to add a forth drop down box which also searches the engine size. How would I go about adding another drop down list? Any help would be much appreciated. I've had to split the code into two lots and there is too many characters to fit in one thread! Code: <script type="text/javascript"> product = new Array ("CATALYTIC-CONVERTER","CENTRAL-SILENCER","FRONT-PIPE","Rear-Assembly"); make = new Array ("ALFA_ROMEO","AUDI","BMW","CITROEN","DAEWOO","FIAT","FORD","HONDA","HYUNDAI","JAGUAR","LAND_ROVER","LEXUS","MAZDA","MERCEDES","MG","MITSUBISHI","NISSAN","PEUGEOT","RENAULT","ROVER","SAAB","SEAT","SKODA","SUBARU","SUZUKI","TOYOTA","VAUXHALL","VOLKSWAGEN","VOLVO"); ALFA_ROMEO = new Array ("ALFA ROMEO 145", "145", "ALFA ROMEO 146", "146", "ALFA ROMEO 147", "147", "ALFA ROMEO 155", "155", "ALFA ROMEO 156", "156", "ALFA ROMEO 164", "164","ALFA ROMEO 166", "166","ALFA ROMEO 75", "75","ALFA ROMEO 33","33","ALFA ROMEO GTV", "GTV","ALFA ROMEO SPIDER","SPIDER"); AUDI = new Array ("AUDI 80","80","AUDI 90","90","AUDI 100","100","AUDI 200","200","AUDI A2","A2","AUDI A3","A3","AUDI A4","A4","AUDI A6","A6","AUDI A8","A8","AUDI CABRIOLET","AUDI COUPE","COUPE","AUDI S3","S3","AUDI S4","S4","AUDI S6","S6", "AUDI S8","S8","AUDI TT","TT"); BMW = new Array ("BMW 316","316","BMW 318","318","BMW 320","320","BMW 323","323","BMW 325","325","BMW 328","328","BMW 518","518","BMW 520","520","BMW 523","523","BMW 525","525","BMW 528","528","BMW 530","530","BMW 535","535","BMW 540","540","BMW 728","728","BMW 730","730","BMW 735","735","BMW 750","750","BMW 840","840","BMW 850","850","BMW M3","M3","BMW M5","M5","BMW Z3","Z3","BMW MINI","MINI"); CITROEN = new Array("CITROEN AX","AX","CITROEN BERLINGO","BERLINGO","CITROEN BX","BX","CITROEN C15","C15","CITROEN C5","C5","CITROEN DISPATCH","DISPATCH","CITROEN RELAY","RELAY","CITROEN SAXO","SAXO","CITROEN SYNERGIE","SYNERGIE","CITROEN XANTIA","XANTIA","CITROEN XM","XM","CITROEN XSARA","XSARA","CITROEN ZX","ZX"); DAEWOO = new Array("DAEWOO ESPERO","ESPERO","DAEWOO KORANDO","KORANDO","DAEWOO LANOS","LANOS","DAEWOO LEGANZA","LEGANZA","DAEWOO MATIZ","MATIZ","DAEWOO MUSSO","MUSSO","DAEWOO","NEXIA","DAEWOO","NUBIRA","DAEWOO TACUMA","TACUMA"); FIAT = new Array("FIAT BARCHETTA","BARCHETTA","FIAT BRAVA","BRAVA","FIAT BRAVO","BRAVO","FIAT CINQUECENTO","CINQUECENTO","FIAT COUPE","COUPE","FIAT CROMA","CROMA","FIAT DOBLO","DOBLO","FIAT DUCATO","DUCATO","FIAT FIORINO","FIORINO","FIAT MAREA","MAREA","FIAT MULTIPLA","MULTIPLA","FIAT PANDA","PANDA","FIAT PUNTO","PUNTO","FIAT SCUDO","SCUDO","FIAT SEICENTO","SEICENTO","FIAT TEMPRA","TEMPRA","FIAT TIPO","TIPO","FIAT ULYSSE","ULYSSE","FIAT UNO","UNO"); FORD = new Array("FORD COUGAR","COUGAR","FORD ESCORT","ESCORT","FORD EXPLORER","EXPLORER","FORD FIESTA","FIESTA","FORD FOCUS","FOCUS","FORD GALAXY","GALAXY","FORD GRANADA","GRANADA","FORD KA","KA","FORD MAVERICK","MAVERICK","FORD MONDEO","MONDEO","FORD ORION","ORION","FORD PROBE","PROBE","FORD PUMA","PUMA","FORD SCORPIO","SCORPIO","FORD SIERRA","SIERRA","FORD TOURNEO","TOURNEO","FORD TRANSIT","TRANSIT"); HONDA = new Array("HONDA ACCORD","ACCORD","HONDA CIVIC","CIVIC","HONDA CONCERTO","CONCERTO","HONDA CRV","CRV","HONDA HRV","HRV","HONDA INTEGRA","INTEGRA","HONDA JAZZ","JAZZ","HONDA LEGEND","LEGEND","HONDA PRELUDE","PRELUDE","HONDA SHUTTLE","SHUTTLE","HONDA STREAM","STREAM"); HYUNDAI = new Array("HYUNDAI ACCENT","ACCENT","HYUNDAI ATOS","ATOS","HYUNDAI COUPE","COUPE","HYUNDAI LANTRA","LANTRA","HYUNDAI PONY","PONY","HYUNDAI S COUPE","S COUPE","HYUNDAI SONATA","SONATA"); JAGUAR = new Array("JAGUAR S TYPE","S TYPE","JAGUAR XJ12","XJ12","JAGUAR XJ6","XJ6","JAGUAR XJ8","XJ8","JAGUAR XJR","XJR","JAGUAR XJS","XJS","JAGUAR XK8","XK8"); LAND_ROVER = new Array("LAND-ROVER 110","110","LAND-ROVER 90","90","LAND-ROVER DEFENDER","DEFENDER","LAND-ROVER DISCOVERY","DISCOVERY","LAND-ROVER FREELANDER","FREELANDER","RANGE-ROVER","RANGE ROVER"); LEXUS = new Array("LEXUS ES","ES SERIES","LEXUS GS","GS SERIES","LEXUS IS","IS SERIES","LEXUS LS","LS SERIES","LEXUS LX","LX SERIES","LEXUS RX","RX SERIES","LEXUS SC","SC SERIES","LEXUS SOARER","SOARER"); MAZDA = new Array("MAZDA 121","121","MAZDA 2","2","MAZDA 323","323","MAZDA 323F","323F","MAZDA 6","6","MAZDA 616","616","MAZDA 626","626","MAZDA 929","929","MAZDA DEMIO","DEMIO","MAZDA MPV","MPV","MAZDA MX3","MX3","MAZDA MX5","MX5","MAZDA MX6","MX6","MAZDA PREMACY","PREMACY","MAZDA RX7","RX7","MAZDA RX8","RX8","MAZDA TRIBUTE","TRIBUTE","MAZDA XEDOS","XEDOS"); MERCEDES = new Array("MERCEDES 180","180","MERCEDES 190","190","MERCEDES 200","200","MERCEDES 220","220","MERCEDES 230","230","MERCEDES 240","240","MERCEDES 280","280","MERCEDES 300","300","MERCEDES 320","320","MERCEDES 400","400","MERCEDES 420","420","MERCEDES 430","430","MERCEDES 500","500","MERCEDES 600","600","MERCEDES A CLASS","A CLASS","MERCEDES C CLASS","C CLASS","MERCEDES E CLASS","E CLASS","MERCEDES G WAGON","G WAGON","MERCEDES ML","ML","MERCEDES SPRINTER","SPRINTER","MERCEDES V","V","MERCEDES VITO","VITO"); MG = new Array("MG 25","25","MG MGF","MGF","MG RV8","RV8","MG TF","TF","MG ZR","ZR","MG ZS","ZS","MG ZT","ZT"); MITSUBISHI = new Array("MITSUBISHI 3000","3000","MITSUBISHI CARISMA","CARISMA","MITSUBISHI COLT","COLT","MITSUBISHI ECLIPSE","ECLIPSE","MITSUBISHI EVO","EVO","MITSUBISHI FTO","FTO","MITSUBISHI GALANT","GALANT","MITSUBISHI GTO","GTO","MITSUBISHI L200","L200","MITSUBISHI L300","L300","MITSUBISHI L400","L400","MITSUBISHI LANCER","LANCER","MITSUBISHI PAJERO","PAJERO","MITSUBISHI SHOGUN","SHOGUN","MITSUBISHI SIGMA","SIGMA","MITSUBISHI SPACE STAR","SPACE STAR","MITSUBISHI SPACEWAGON","SPACEWAGON"); NISSAN = new Array("NISSAN 100 NX","100 NX","NISSAN 200 SX","200 SX","NISSAN 300 ZX","300 ZX","NISSAN 350 Z","350 Z","NISSAN 1800 SX","1800 SX","NISSAN ALMERA","ALMERA","NISSAN BLUEBIRD","BLUEBIRD","NISSAN CABSTAR","CABSTAR","NISSAN CHERRY","CHERRY","NISSAN MICRA","MICRA","NISSAN MAXIMA","MAXIMA","NISSAN PRIMERA","PRIMERA","NISSAN SERENA","SERENA","NISSAN SKYLINE","SKYLINE","NISSAN SUNNY","SUNNY","NISSAN TERRANO","TERRANO","NISSAN X TRAIL","X TRAIL"); PEUGEOT = new Array("PEUGEOT 106","106","PEUGEOT 107","107","PEUGEOT 205","205","PEUGEOT 206","206","PEUGEOT 306","306","PEUGEOT 307","307","PEUGEOT 309","309","PEUGEOT 405","405","PEUGEOT 406","406","PEUGEOT 407","407","PEUGEOT 605","605","PEUGEOT 607","607","PEUGEOT 806","806","PEUGEOT 807","807","PEUGEOT 1007","1007","PEUGEOT BOXER","BOXER","PEUGEOT EXPERT","EXPERT","PEUGEOT PARTNER","PARTNER"); RENAULT = new Array("RENAULT CLIO","CLIO","RENAULT ESPACE","ESPACE","RENAULT KANGOO","KANGOO","RENAULT LAGUNA","LAGUNA","RENAULT MEGANE","MEGANE","RENAULT SAFRANE","SAFRANE","RENAULT SCENIC","SCENIC","RENAULT R19","R19","RENAULT R21","R21"); ROVER = new Array("ROVER 111","111","ROVER 114","114","ROVER 211","211","ROVER 214","214","ROVER 216","216","ROVER 218","218","ROVER 220","220","ROVER 25","25","ROVER 323","323","ROVER 414","414","ROVER 416","416","ROVER 420","420","ROVER 45","45","ROVER 618","618","ROVER 620","620","ROVER 623","623","ROVER 75","75","ROVER 820","820","ROVER 825","825","ROVER 827","827","ROVER MAESTRO","MAESTRO","ROVER METRO","METRO","ROVER MG","MG","ROVER MGF","MGF","ROVER MINI","MINI","ROVER MONTEGO","MONTEGO","ROVER STREETWISE","STREETWISE"); SAAB = new Array("SAAB 9-3","9-3","SAAB 9-4","9-4","SAAB 9-5","9-5","SAAB 90","90","SAAB 99","99","SAAB","900","SAAB 9000","9000"); SEAT = new Array("SEAT ALHAMBRA","ALHAMBRA","19AUK35","ALTEA","SEAT AROSA","AROSA","SEAT CORDOBA","CORDOBA","SEAT IBIZA","IBIZA","SEAT INCA","INCA","SEAT LEON","LEON","SEAT MALAGA","MALAGA","SEAT MARBELLA","MARBELLA","SEAT TERRA","TERRA","SEAT TOLEDO","TOLEDO"); SKODA = new Array("SKODA FABIA","FABIA","SKODA FAVORIT","FAVORIT","SKODA FELICIA","FELICIA","SKODA OCTAVIA","OCTAVIA","SKODA SUPERB","SUPERB","SKODA TAVRIA","TAVRIA"); SUBARU = new Array("SUBARU FORESTER","FORESTER","SUBARU IMPREZA","IMPREZA","SUBARU JUSTY","JUSTY","SUBARU LEGACY","LEGACY","SUBARU LIBERO","LIBERO","SUBARU SVX","SVX","SUBARU VIVIO","VIVIO"); SUZUKI = new Array("SUZUKI ALTO","ALTO","SUZUKI BALENO","BALENO","SUZUKI CARRY","CARRY","SUZUKI GRAND VITARA","GRAND VITARA","SUZUKI JIMMY","JIMMY","SUZUKI ESTEEM","ESTEEM","SUZUKI IGNIS","IGNIS","SUZUKI LIANA","LIANA","SUZUKI SAMURAI","SAMURAI","SUZUKI SWIFT","SWIFT","SUZUKI VITARA","VITARA","SUZUKI WAGON","WAGON"); TOYOTA = new Array("TOYOTA AVENSIS","AVENSIS","TOYOTA CAMRY","CAMRY","TOYOTA CARINA","CARINA","TOYOTA CELCIA","CELICA","TOYOTA COROLLA","COROLLA","19S35","ESTIMA","TOYOTA HI-ACE","HI-ACE","TOYOTA HI-LUX","HI-LUX","TOYOTA LAND CRUISER","LAND CRUISER","TOYOTA MR2","MR2","TOYOTA PASEO","PASEO","TOYOTA PICNIC","PICNIC","TOYOTA PREVIA","PREVIA","TOYOTA PRIUS","PRIUS","TOYOTA RAV 4","RAV 4","TOYOTA SPACECRUISER","SPACECRUISER","TOYOTA STARLET","STARLET","TOYOTA SUPRA","SUPRA","TOYOTA YARIS","YARIS"); </script> <script type="text/javascript"> VAUXHALL = new Array("VAUXHALL ASTRA","ASTRA","VAUXHALL BRAVA","BRAVA","VAUXHALL CALIBRA","CALIBRA","VAUXHALL CAVALIER","CAVALIER","VAUXHALL COMBO","COMBO","VAUXHALL CORSA","CORSA","VAUXHALL FRONTERA","FRONTERA","VAUXHALL MERIVA","MERIVA","VAUXHALL MONTERRY","MONTERRY","VAUXHALL NOVA","NOVA","VAUXHALL OMEGA","OMEGA","VAUXHALL SENATOR","SENATOR","VAUXHALL SIGNUM","SIGNUM","VAUXHALL SINTRA","SINTRA","VAUXHALL TIGRA","TIGRA","VAUXHALL VECTRA","VECTRA","VAUXHALL ZAFIRA","ZAFIRA"); VOLKSWAGEN = new Array("VOLKSWAGEN BEETLE","BEETLE","VOLKSWAGEN BORA","BORA","VOLKSWAGEN CADDY","CADDY","VOLKSWAGEN CARAVELLE","CARAVELLE","VOLKSWAGEN CORRADO","CORRADO","VOLKSWAGEN GOLF","GOLF","VOLKSWAGEN JETTA","JETTA","VOLKSWAGEN LUPO","LUPO","VOLKSWAGEN PASSAT","PASSAT","VOLKSWAGEN POLO","POLO","VOLKSWAGEN SANTANA","SANTANA","VOLKSWAGEN SCIROCCO","SCIROCCO","VOLKSWAGEN SHARAN","SHARAN","VOLKSWAGEN TRANSPORTER","TRANSPORTER","VOLKSWAGEN VENTO","VENTO"); VOLVO = new Array("VOLVO 240","240","VOLVO 340","340","VOLVO 440","440","VOLVO 460","460","VOLVO 480","480","VOLVO 740","740","VOLVO 760","760","VOLVO 850","850","VOLVO 940","940","VOLVO 960","960","VOLVO C70","C70","VOLVO S40","S40","VOLVO S60","S60","VOLVO S70","S70","VOLVO S80","S80","VOLVO S90","S90","VOLVO V40","V40","VOLVO V50","V50","VOLVO V70","V70","VOLVO V90","V90"); function writeoptions(selectname) { var arr = selectname; var k=arr.length; for (i=0; i<k; i++) { if (arr[i] == "REAR_SILENCER") { document.write ("<OPTION value=\"\">"+arr[i]+"</OPTION>"); } else { document.write ("<OPTION value="+arr[i]+">"+arr[i]+"</OPTION>"); } } } function writeselect(selectedoption) { var opt = selectedoption; var optarray = window[opt] var frm1 = document.myForm; frm1.model.disabled=(frm1.make.selectedIndex==0 || frm1.product.selectedIndex==0); frm1.model.selectedIndex = 0; frm1.model.length = 1; count=1 if(frm1.make.selectedIndex > 0) for(i=0;i<optarray.length;i=i+2) { frm1.model.options[count] = new Option(optarray[i+1],optarray[i]); count++ }} </script> Hi All, I am really stumped. I am not sure why it's not working. Basically, selecting a country will pre-populate the state field for both billing and shipping sections. Please help! Also, when copying the billing info from shipping, the state field doesn't seem to copy over. I have attached the entire code as a text file (part1 + part2 = complete code). Thanks! I am working on a website that involves a pizza. I have a drop down box with the following options: small, medium, large, and extra large. When the user selects small the topping price is $0.75 each, when the user selects medium the topping price is $1.00 each, when the user selects large the topping price is $1.25 each, and when the user selects extra large the topping price is $1.25 each. I the problem is no matter what size the user selects the topping price is always $0.75. Here is code that goes with the drop down box : Code: <td height="49" align="right"><label for="Pizza_Size">Size</label> <select name="Pizza_Size" id="Pizza_Size" onchange = "SetToppingPrice()" /> <option value="Small_Pizza">Small ($4.99)</option> <option value="Medium_Pizza">Medium ($5.99)</option> <option value="Large_Pizza">Large ($7.99)</option> <option value="X_Large_Pizza">X-Large ($10.99)</option> </select></td> Here is the Javascript code: Code: // JavaScript Document function SetToppingPrice() { var Pizza_Topping_Price = document.getElementById("Pizza_Size"); divOutput = document.getElementById("Display_Topping_Price"); if(Pizza_Topping_Price = "Small_Pizza") { divOutput.innerHTML = "$0.75 per topping";} else if (Pizza_Topping_Price = "Medium_Pizza") { divOutput.innerHTML = "$1.00 per topping";} else if (Pizza_Topping_Price = "Large_Pizza") { divOutput.innerHTML = "$1.25 per topping";} else if (Pizza_Topping_Price = "X_Large_Pizza") { divOutput.innerHTML = "$1.50 per topping";} } Any advice is greatly appreciated. Hi, I am currently working in mail client project. The mails are displayed in the html table. I have an requirement to drag and drop the mails from the Inbox to another folder. Can you please suggest how to proceed with this. Thanks in advance. Regards, Anne. Okay everyone, new here, of course, and as much as I hate to be one of those people that don't really know much about a topic at hand and gratuitously seek out the help of those who do, here I am. The upshot is that it's probably something really easy to answer for those who know Javascript already. I've tried figuring this out but I'm at a loss. I can manage pretty well with CSS, messing around and playing with values to figure out what I need, but I've taken a look at the Javascript and it's completely unapproachable for me. I used a website, http://www.mycssmenu.com/ to create a really nifty dropdown menu, which has a tree structure in Javascript as well as collapse and expand buttons. The great thing is that, for those with Javascript disabled, it still fully works as a CSS drop-down menu. But I've been asked to modify it. Right now, you click and that's how things expand. But I've been asked to make it so that it will expand simply on hover.And I don't know what to do at all. Of course I know how to change the colors of the particular fields when you hover, through CSS, but to make it expand simply on hover? Think anyone can give me some pointers or a bit of help? The website in question is here Psiholog Popa Anca. Great job on the colors though, eh? Let me know! Hi Chaps, I'm still having problems with a Javascript 'Lookup' function. Basically, I have a select menu 'Customer' which triggers a 3 JS functions, to populate 2 extra select menus. Code: <script type="text/javascript" language="javascript"> $(document).ready(function(){ $('#customer').change(function() { var option=$(this).val(); getCustContact(this); getCostCentreContact(this); $.get('getCostCentre.php',{select:option},function(data){ $('#result').html(data).hide().fadeIn(1000); }); }); }); </script> <script type="text/javascript" language="javascript"> var ajax_CustContact=new Array(); function getCustContact(sel) { var Customer=sel.options[sel.selectedIndex].value; document.getElementById('custcontact').options.length = 0; if(Customer.length>0){ var index=ajax_CustContact.length; ajax_CustContact[index]=new sack(); ajax_CustContact[index].requestFile='getCustomerContact.php?custid='+Customer; ajax_CustContact[index].onCompletion=function(){createCustContact(index)}; ajax_CustContact[index].runAJAX(); } } function createCustContact(index) { var obj=document.getElementById('custcontact'); eval(ajax_CustContact[index].response); } </script> <script type="text/javascript" language="javascript"> var ajax_CostCentreContact=new Array(); function getCostCentreContact(sel) { var Customer=sel.options[sel.selectedIndex].value; document.getElementById('costcentrecontact').options.length = 0; if(Customer.length>0){ var index=ajax_CostCentreContact.length; ajax_CostCentreContact[index]=new sack(); ajax_CostCentreContact[index].requestFile='getCostCentreContact.php?custid='+Customer; ajax_CostCentreContact[index].onCompletion=function(){createCostCentreContact(index)}; ajax_CostCentreContact[index].runAJAX(); } } function createCostCentreContact(index) { var obj=document.getElementById('costcentrecontact'); eval(ajax_CostCentreContact[index].response); } </script> <select id="customer" name="FK_cust_id"> <option value="">Select Customer</option> <option value="1">Customer A</option> <option value="2">Customer B</option> </select> <select id="custcontact" name="FK_contact_id"> <option value="">--Select Customer First--</option> </select> <select id="costcentrecontact" name="FK_cost_centre_contact_id"> <option value="">--Select Customer First--</option> </select> Using IE Developer Tools, during debugging, I get this error: Quote: Expected ';' Error This relates to either: Code: eval(ajax_CustContact[index].response); OR Code: eval(ajax_CostCentreContact[index].response); (it's a bit random, as sometimes it works, sometimes it doesn't) I have tried changing the 'custid' to 'custname' to check whether it was an integer causing the problem, but had the same problem. If anyone can tell me where I am going wrong, I'd gladly give out a bit hi-5! |