JavaScript - Rollover And Changing Image Src With An Onclick Event
Hi
I am trying to stop a preloaded images used in a rollover. The images are linked to a tab navigation system, that open on the same page. if(document.images){ var image_array = new Array(); // path to the directory with images var path = './images/food-drink/food/'; // enumeration of the "active" images image_array[0] = path + "starters_r.png"; image_array[1] = path + "mains_r.png"; image_array[2] = path + "desserts_r.png"; image_array[3] = path + "childrens_r.png"; image_array[4] = path + "sandwiches_r.png"; image_array[5] = path + "meal_r.png"; var preload_image = new Array (); for(var i=0; i<image_array.length; i++){ preload_image[i]= new Image(); preload_image[i].src = image_array[i]; } } function rollover(name, filename){ var fullpath = './images/food-drink/food/' + filename; document.images[name].src = fullpath; } I am trying to change the image with another one, which will change back when a different image is clicked. The problem seems to be that the tab navigation code is disagreeing with other code I have tried. The tab code looks like this and works fine until I add another code with document.getElementById() to the onClick event. function swichtabs(wert) { if (wert=='1'){ /*menu starters tab*/ document.getElementById('tabStarters').className='tab1 tabactive'; document.getElementById('tabMains').className='tab2'; document.getElementById('tabDesserts').className='tab3'; document.getElementById('tabChildrens').className='tab4'; document.getElementById('tabSandwiches').className='tab5'; document.getElementById('tabMeals').className='tab6'; }else if (wert=='2'){ etc... The html code for the image is: <a href="#starters" onmouseout="rollover('btnStarters','starters.png')" onmouseover="rollover('btnStarters','starters_r.png')" onClick="this.onMouseOver=null;this.onMouseOut=null; blendon('starters'); blendoff('mains');etc...; swichtabs('1');" onclick="return false;" title="Starters" id="tabStarters"> <img src="./images/food-drink/food/starters.png" name="btnStarters" width="129" height="30" border="0" /> </a> I would be grateful if you could point me in the right direction. Similar TutorialsHi all, I can't seem to add an onclick event to an image. I'm sure I am doing something wrong as I am very new to Javascript. This is a part of my javascript code that is in the head and body of my HTML file: Code: <head> <script language="JavaScript"> ..... ..... var redLocation0 = redArray[0]+".jpg"; .... .... function redClick( buttonLocation ) { window.location = "http://www.yahoo.com/" } .... .... </script> </head> <body> <table> <tr> <td> <script language="javascript">document.write('<IMG SRC="'+ redLocation0 +'">'); onclick="redClick('0')";</script> </td> </tr> </table> </body> The image that is displayed is not clickable, and therefore the function redClick cannot be called. Can someone please help me and tell me where I am going wrong here. I am kinda new to JavaScript. Thanks! I'm very inexperienced with Javascript, but want to use the onclick event to change an image to text. I'm working on a directory type website and want users to have to click on the image of a telephone in order to reveal the telephone number they are looking for. how do i do this? Also is there a way of tracking how many clicks each person gets? I'd really appreciate any help you guys can give me on this I would like to set up an image gallery so that when customer clicks on their chosen image, the image caption populates into the associated field in the form below the gallery, on the same page. Any way you know of to do this? I am not really a coder, I only know this and that, so examples or detailed instructions will be most helpful. Thanks very much. Hey guys, Lookin' for a little help, not sure if it can even be done? hopefully someone has the answer. I'm trying to design myself an online portfolio; here's what I got so far... http://www.gregorymstevens.com/testsite/site.html As you can see my navigation is represented by each bird on the tree (every bird is a link), when you rollver one of the green birds they turn white, however, I am looking to not only have the green bird rollver to white but ALSO have the "choose a" image on the bottom right change to the corresponding page. For instance, when the mouse rolls over a bird-- this image: will turn into this image: while maintaining the original "white bird" rollover. Hopefully I'm explaining this correctly -- Any help greatly appreciated! Hi, New to javascript. Doing web page with ASP/VB.NET. Have text boxes for UI on page. Two command buttons - Submit (for db update) and Cancel. I need the Cancel button to prompt the user to verify cancellation. Need OK/Cancel buttons on alert. If user selects Cancel-no action. If user selects OK then I want the text boxes cleared of user text input and focus returned to first text box. I think this may be the code but do not know how to apply it. function Clear() { var res=window.confirm("Please confirm cancellation-text boxes will be cleared"); if(res==true) { document.getElementById("StrtDte").value=""; document.getElementById("EndDte").value=""; document.getElementById("txtProjRegHrsAl").value=""; document.getElementById("txtProjOTHrsAl").value=""; document.getElementById("ddlRAS").focus(); } } Is this code valid or invalid for the events I need? How do I set it to fire when user clicks the ASP Cancel button? Thanks, John Hello forum, My name is juan and recently started html programming. I have a web page with a drop box with the name of states. Code: <option value="">Alabama</option> <option value="">Alaska</option> I can add a onclick="code here" to the tag so that when the drop box alabama is selected it triggers the onclick event. Im using Ibox in order to have a image of the state open. Code: <a href="images/large/image_1b.jpg" rel="ibox" title="alabama at 1024x450!"><img src="images/small/image_1.jpg" alt=""/></a> the above is a <a> link tag correct? How do I go bout adding the above code into the onclick event? hi, i need to be able to take the values from two text boxes and change the location of a sprite on my canvas, i've searched the internet and it doesnt really explain how to do it for me. here is my code: x: <input type="text" name="x" id="x"/><br /> y: <input type="text" name:"y" id="y"/><br /> <input type="submit" value="Submit" onClick="ChangeCo()" /><br /> function ChangeCo() { } and i need the function to take the x and y values from the text boxes and change the values of my variables: var block_x; var block_y; block_x = 290; block_y = 70; Thankyou in advance Hi, I am trying to get my onclick event to handle both of the function below. I want the event to return false (stop executing) if any of the two functions return false. Here is my code: Code: function isNumeric(elem, helperMsg){ var numericExpression = /[0-9]+/; if(!elem.value.match(numericExpression)){ SaveRecord(); return true; }else{ alert("You cannot enter numbers in the Comments field."); return false; } } function lengthRestriction(elem, min, max){ var x = elem.value; if(x.length >= min && x.length <= max){ SaveRecord(); }else{ alert("Please enter between " +min+ " and " +max+ " characters in the Issue Number field"); } } Please help me. Thank you. I've got a checkbox that, when clicked, displays new text inputs. However, when I "uncheck" the box, the fields don't disappear unless I reload the entire page. What code can I add to reset the box to null when it is unchecked? Here's the function code I have: Code: <script> function showUserReg() { document.getElementById("userReg").style.display = "inline"; } </script> And here's the inline code: Code: <input type="checkbox" name="additional" value="userRegister" onclick="showUserReg()"/> Yes! Register me now!<br/> <span id = "userReg" style="display:none"> <table class="nobord" align="center"> <tr> <td>Choose a username:</td> <td><input type="text" name="username" size="35"/></td> </tr> <tr> <td>Choose a password:</td> <td><input type="password" name="password" size="35" maxlength="20"/></td> </tr> <tr> <td>Confirm password:<font color="red">*</font></td> <td><input type="password" name="password" size="35" maxlength="20"/></td> </tr> </table> </span> Thanks for any help. I was trying to help someone on another forum and seem to have run into a brick wall. The main problem that has got me stumped at the moment is that clicking on the images in the 1st tab work fine. However the subsequent tab selections and clicks do not change the "bigImage" correctly (not at all). Perhaps some other more experienced forum members can identify what I doing wrong at this time. I believe it is in my set-up of the onclick events in the "onload=" section, but I not the best at this event stuff yet! Code: var sel, tmp, elem; var j=0; for (var i=0; i<imgGroupArray.length; ++i) { sel = document.getElementById('imgGroup'+i).getElementsByTagName('img'); while (elem=sel[j++]) { elem.onclick = function() { setBigImage(this.src); } } } Here is the full code that 'almost' works: Code: <!DOCTYPE HTML> <html> <head> <title> Tab Gallery </title> <style type="text/css"> li { display:inline; list-style-type:none; border:1px solid blue; margin:3px; } .imgBlock { display:none; } </style> <script type="text/javascript"> // From: http://www.webdeveloper.com/forum/showthread.php?t=250787 var baseURL = 'http://www.nova.edu/hpd/otm/pics/4fun/'; var imgGroupArray = [ ['11.jpg','12.jpg','13.jpg','14.jpg','15.jpg'], ['21.jpg','22.jpg','23.jpg','24.jpg','25.jpg'], ['31.jpg','32.jpg','33.jpg','34.jpg','35.jpg'], ['41.jpg','42.jpg','43.jpg','44.jpg','45.jpg'], ['51.jpg','52.jpg','53.jpg','54.jpg','55.jpg'], ['61.jpg','62.jpg','63.jpg','64.jpg','65.jpg'] // NOTE: No comma after last entry ]; function tabGroup(which) { var sel = document.getElementById('imgGroup').getElementsByTagName('div'); for (var i=0; i<sel.length; ++i) { sel[i].style.display = 'none'; } var tmp = 'imgGroup'+which; // alert(tmp); document.getElementById(tmp).style.display = 'block'; } function setBigImage(info) { // alert(info); document.getElementById('bigImage').src = info; } window.onload = function() { var img; for (var i=0; i<imgGroupArray.length; ++i) { for (var j=0; j<imgGroupArray[i].length; ++j) { img = document.createElement('img'); img.setAttribute('src', baseURL+imgGroupArray[i][j]); img.setAttribute('height','100px'); img.setAttribute('width','75px'); document.getElementById('imgGroup'+i).appendChild(img); } } // Following modified from: // http://www.codingforums.com/showthread.php?t=102896&highlight=addevent+onclick var sel, tmp, elem; var j=0; for (var i=0; i<imgGroupArray.length; ++i) { sel = document.getElementById('imgGroup'+i).getElementsByTagName('img'); while (elem=sel[j++]) { elem.onclick = function() { setBigImage(this.src); } } } tabGroup(0); } </script> </head> <body> <div id="tabMenu"> <div style="float:left"> <li onclick="tabGroup(0)">Tab 1</li> <li onclick="tabGroup(1)">Tab 2</li> <li onclick="tabGroup(2)">Tab 3</li> <li onclick="tabGroup(3)">Tab 4</li> <li onclick="tabGroup(4)">Tab 5</li> <li onclick="tabGroup(5)">Tab 6</li> </div><br> <div id="imgGroup" style="width:300px; height:300px; border:1px solid red; float:left"> <div id="imgGroup0" class="imgBlock"></div> <div id="imgGroup1" class="imgBlock"></div> <div id="imgGroup2" class="imgBlock"></div> <div id="imgGroup3" class="imgBlock"></div> <div id="imgGroup4" class="imgBlock"></div> <div id="imgGroup5" class="imgBlock"></div> </div> <div id="bigImageDiv" style="width:250px; height:300px; border:1px solid red; float:left;"> <img id="bigImage" src="" alt="bigImage here!"> </div> <br style="clear:both"> </div> </body> </html> here the deal ,,I've solved all but this problem in my script i have my page setup with 1 iframe and the main html the code below is exactly how the page will show up in the iframe, you can copy and paste the whole thing and save it as a htm file to view if needed.. I need a way to catch the clicks that happen within the iframe but from the main section of the page..heres why! this is inserted at the top of the page if(top.location==self.location){top.location="RefESI_search.asp";} just above top.document.reset.RefCat.value= I can get the page to load even with this in the iframes ..but for the purposes of this i left it out so the page would load ok for anyone thats gonna try and help . theres only 2 links in the code.. hopefully whatever will hopefully solve this problem will be able to tell which links were clicked,and i can can point them to the apropriate links. I've looked thru alot of the threads so i know there are some extremely brite ppl in here that can knock this problem out of the ball park very easily.. you can grab the styles sheet from here https://www.docs.sony.com/reflib/Style_esi.css Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Ref_Lib_Results</title> <link rel="stylesheet" type="text/css" href="home.css"/> <script language="javascript"> top.document.reset.RefCat.value="Home Receiver"; top.document.reset.NarrowRef.value="Good"; top.document.reset.criteria.value="stra"; top.document.reset.searchscope.value="model"; top.document.reset.companyscope.value="SONY"; top.document.reset.company.value="SONY"; if(""==""){top.reset();} function popUp(URL,Name) { var day = new Date(); var id = "page" + Name; window.open(URL, id, "toolbar=1,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=600,height=600"); } function launchjsmanuals(flag, x, y, z, id) { //var myTypeLib = new ActiveXObject("Scriptlet.Typelib"); //var GUID = new String(myTypeLib.guid).substr(1,8); //var endguid = new String(myTypeLib.GUID).substr(25,10); if((x.indexOf("CHM")!=-1) || (x.indexOf("chm")!=-1)){ alert("You will be prompted to download a file\n\nClick Open - Do NOT click Save"); } var whnd = "page" + id; //+ GUID + endguid; var URL = '_manualusage.asp?flag='+flag+'&manual=' + x + '&user=' + y + z + '&manualid=' + id; if(flag!=""){ whnd = window.open(URL,whnd, "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=560,height=600"); }else{ whnd = window.open(URL,"Loader", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=560,height=600"); } } function emailit(id, url,name,type,filesize,model,email,custname,cs3event,user){ var namestring = name; var re = new RegExp('&','gi'); namestring = namestring.replace(re,'and'); name = namestring; var xurl = "/srvs/common/email.asp?id="+id+"&emailurl="+url+"&title=" + name + "&type="+type+"&model=" + model + "&filesize=" + filesize + "&email=" + email + "&custname=" + custname + "&convid=" +cs3event + "&user=" + user; popUp(xurl,id); } function NarrowSearch(what,value,cat){ switch(what){ case "Category": parent.document.SearchForm.RefCat.value=value; parent.document.SearchForm.NarrowRef.value="Good"; parent.document.SearchForm.submit() break; case "Model": if("Home Receiver"!=""){ parent.document.SearchForm.RefCat.value="Home Receiver"; } parent.document.SearchForm.criteria.value=value; parent.document.SearchForm.searchscope.value="model"; parent.document.SearchForm.NarrowRef.value="Good"; parent.document.SearchForm.submit() break; case "ONLY": parent.document.SearchForm.criteria.value=value; parent.document.SearchForm.searchscope.value="model"; parent.document.SearchForm.RefCat.value=cat; parent.document.SearchForm.NarrowRef.value="Only"; parent.document.SearchForm.submit() break; case "ALL": parent.document.SearchForm.criteria.value=value; parent.document.SearchForm.RefCat.value=cat; parent.document.SearchForm.NarrowRef.value="ALL"; parent.document.SearchForm.submit() break; } } </script> </head> <body> <div id="results"> <div style="height: 400px;border-bottom:1px solid black;" class="modelblock"> <div style="margin-left:20px; margin-right:15px; margin-top:10px; font-size:10pt"> <span style="float:Right;margin-top:10px;text-align:right"> <table border=0 cellpadding=0 cellspacing=0><tr><td> <div style="background:silver;color:black;font-size:10px;padding:2px;border:1px solid gray;cursor:pointer" onclick="javascript:NarrowSearch('ALL','stra','Home Receiver')">Display All Models</div> </td><td> </td><td><div style="width:40px;background:silver;color:black;font-size:10px;padding:2px;border:1px solid gray;cursor:pointer;text-align:center" onclick="javascript:history.go(-1)">Back</div></td></tr></table></span><b>Your search of "<font color=green>stra</font>" matches 66 Models in the Home Receiver category.</b><br><br>Please select the specific model to continue:<table border=0 cellpadding=0 cellspacing=2><tr><td><a class="modellink" onMouseOver="this.className='modellinkhover'" onMouseOut="this.className='modellink'" onclick="javascript:NarrowSearch('ONLY','STRAV1000','Home Receiver')"><b>STRA</b>V1000</a></td><td width=15px></td><td><a class="modellink" onMouseOver="this.className='modellinkhover'" onMouseOut="this.className='modellink'" onclick="javascript:NarrowSearch('ONLY','STRAV1010','Home Receiver')"><b>STRA</b>V1010</a></td><td width=15px></td></tr></table</div></div></div> <iframe name="Loader" id="Loader" src="blank.htm" style="display:none;height:150px;width:100%;border:1px solid silver"></iframe> <a onclick="document.getElementById('Loader').style.display='';">*</a> <script language="javascript"> //alert(parent.IQ.location.href); </script> </body> </html> Hi I would like to use javascript to control what tooltip displays when a tab is rolled over depending on which tab was clicked. Code: <li id='1tab_1a' class='selected'><a id='1link_1a' title="Customer Info Screen"><span >Customer Info</span></a></li> <li id='1tab_1b' ><a id='1link_1b' title="Order Detail" ><span>Order</span></a></li> <li id='1tab_1c' ><a id='1link_1c' title="Phone Detail" ><span>Phone: 7093521232</span></a></li> For example when the Customer Info tab is selected I would like the tooltips to be like above but when Order is the tab selected I would like the tooltip to say Customer Info Detail, Order Detail Screen, and Phone Detail. How could I use an onclick event to control what tooltip is being displayed depending on which tab is selected? I have about 20 sets of customer info and sometimes not everyone contains all of the tabs and I would also like to be able to add more customers. I'm having an issue where a programmatic click event is not behaving the same way the cursor click event is. A cursor click returns the correct object from GetObject(). The programmatic click triggered by a USB device is returning undefined from GetObject(). How can this be resolved? Edit: It appears that it does not recognize eval(document.getElementById(gButtonList[gButtonId])).onclick(); as an event. Why is this? How can I get it to recognize it? Edit2: Resolved it myself. See green text below. TestPage.htm: Code: <script language="JavaScript" src="../bin/USBHelperFile.js"></script> <script language="JavaScript" type="text/JavaScript"> function BuildButtons() { for (var i = 0; i < testArray.length; i++) { // Create Div [Buttons created programmatically] var divNode = document.createElement('div'); divNode.id = 'div' + i; divNode.onclick= ClickFunction; etc... } } function ClickFuntion(nodeButtonNum) { alert(GetObject()); Returns the index for a cursor click. Returns undefined for the programmatic click triggered by the USB device } function GetObject() { var node = event.srcElement; return node; } </script> USBHelperFile.js: Code: This JS file works with a USB hardware device that can navigate through divs and click them when they have focus. function HelperFunction(keyCommand) { switch (keyCommand) { case: "click": // eval(document.getElementById(gButtonList[gButtonId])).onclick(); var target = eval(document.getElementById(gButtonList[gButtonId])); target.fireEvent("onclick"); break; } } I assum the following html code: <div id="id1" onclick="click()">A<div> <div id="id2" onclick="click()">B<div> Do you know how to get ID = id2 when I onclick on A? hello everyone, i am new to all this.. i need help regarding.. i am generating text box dynamically(mean it's a multiple select box, depending upon the number you select , it will generate that many text field.) my problem is that i want to assign a calender to the text field generated whenever a user clicks on that text field. i am able to do it for simple text field as onclick="javascript: showCalendar('idname')" but how to do it in this case, where can i declare this ? Is it possible to have an onclick event on a readonly input field? I want to avoid the mouseover event.
The following coding works in Konqueror 3.5.10 on Ubuntu 8.04.3 LTS but not on Firefox 3.0.10 Linux/3.5.7 XP, Opera 10.10 Linux or IE8 XP. I can't see why but it may be to do with the recursion (showtable calls onclick calls addit which calls showtable ...). Somehow it is not seeing the addit routine the second time round. It is meant just to add a line. Eventually it needs to be a complex table but this is for illustration. There are other ways to solve this but this would be the simplest - if it worked! What happens is that one line is added OK but then it chokes. This is what makes me think it is the recursion but I can't see otherwise how to make it write the updated text. I realise I should have a document.close() in it as well and I have tried adding <![CDATA[ ... ]]> as well. Other than in Konqueror, it gives an error message saying object not found (in IE8) or more explicitly: Code: function onclick(event){ addit(4); } with 'addit is not defined' in Firebug. In Konqueror it works sweetly. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> <head> <script language='Javascript' type='text/javascript'> if(typeof(sections) == 'undefined'){ var sections=['Text 0','Text 1','Text 2']; } function addit(ilocal){ sections.splice(sections.length,0,'Text '+ilocal); showtable(); } function showtable(){ var i,j,ip1; for(i=0;i<sections.length;i++){ ip1=i+1; document.write('Section ',i,': ',sections[i],'<br>'); } document.write("<input type='button' value='Add' onClick='addit(",ip1,")' /><br>"); for(j=0;j<sections.length;j++){document.write(sections[j]," ");} } </script> </head><body> <script language='Javascript' type='text/javascript'> showtable(); </script> </body> </html> Clues would be very much appreciated - my baldness coefficient is increasing daily! I am try to make a form that appears to be multi page. I am trying to use a button to hide one div and display another at the same time my script is head Code: <script language=javascript type='text/javascript'> function hidediv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){//if they are 'see' divs if (document.getElementById) // DOM3 = IE5, NS6 divs[i].style.visibility="hidden";// show/hide else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'hidden'; else // IE 4 document.all.hideShow.divs[i].visibility = 'hidden'; } } } function showdiv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){ if (document.getElementById) divs[i].style.visibility="visible"; else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'visible'; else // IE 4 document.all.hideShow.divs[i].visibility = 'visible'; } } } </script> body Code: <form name="PublicOrderPage" action="save_client_information.php" onsubmit="return validateForm()" method="post"> <div id="div1" style="width:600px; height: auto;background: yellow;"> <table width="600" border="0"> <tr> <legend><h3 style="padding-left:172.5px;">Required Client Information</h3></legend> </tr> <tr> <td style="padding-left:25px;"><b>Name:</b></td> <td><input type="text" name="client_name" id="client_name" value="<?php echo $_POST['client_name']; ?>" /></td> <td style="padding-left:25px;"><b>Home Phone:</b></td> <td><input type="text" name="client_home_phone" id="client_home_phone" value="<?php echo $_POST['client_home_phone']; ?>" /></td> </tr> </table> <br/> <table width="270" border="0"> <tr> <td style="padding-left: 180px;"><b>Email:</b></td> <td><input type="text" name="client_email" id="client_email" value="<?php echo $_POST['client_email']; ?>" /></td> </tr> </table> <br/> <table> <tr> <td style="padding-left:280px;"><input name="save_client_info" type="button" value="Next" onclick="hidediv('1');shwodiv('2');" > </td> </tr> </table> </div> <div id="div2" style="width:600px; height: auto;background: yellow; "> <table width="600" border="0"> <tr> <legend><h3 style="padding-left:172.5px;">Required Site Information</h3></legend> </tr> <tr> <td style="padding-left:25px;"><b>Site Street:</b></td> <td><input type="text" name="site_street" id="site_street" value="<?php echo $_POST['site_street']; ?>" /></td> <td style="padding-left:25px;"><b>Site City:</b></td> <td><input type="text" name="site_city" id="site_city" value="<?php echo $_POST['site_city']; ?>" /></td> </tr> </table> <br/> <legend><h3>Inspection Type</h3></legend> <table width="270" border="0"> <table width="602" border="0"> <tr> <td width="252"><input type="checkbox" name="cb_full_home" id="cb_full_home" <?php if ($_POST['cb_full_home']) echo 'checked="checked"'; ?> /> Full Home</td> <td width="150"><input type="checkbox" name="cb_4_point" id="cb_4_point" <?php if ($_POST['cb_4_point']) echo 'checked="checked"'; ?> /> 4 Point</td> </tr> <tr> <td ><input type="checkbox" name="cb_condominium" id="cb_condominium" <?php if ($_POST['cb_condominium']) echo 'checked="checked"'; ?> /> Condominium</td> <td ><input type="checkbox" name="cb_wind_mit" id="cb_wind_mit" <?php if ($_POST['cb_wind_mit']) echo 'checked="checked"'; ?> /> Wind Mit</td> </tr> <tr> <td ><input type="checkbox" name="cb_roof_cert" id="cb_roof_cert" <?php if ($_POST['cb_roof_cert']) echo 'checked="checked"'; ?> /> Roof Cert</td> <td ><input type="checkbox" name="cb_drywall" id="cb_drywall" <?php if ($_POST['cb_drywall']) echo 'checked="checked"'; ?> /> Drywall</td> </tr> <tr> <td><input type="checkbox" name="cb_reinspect" id="cb_reinspect" <?php if ($_POST['cb_reinspect']) echo 'checked="checked"'; ?> /> Re-Inspect</td> <td><input type="checkbox" name="cb_followup" id="cb_followup" <?php if ($_POST['cb_followup']) echo 'checked="checked"'; ?> /> Follow-Up</td> </table> <img src="CaptchaSecurityImages.php" /> Security Code: <input id="security_code" name="security_code" type="text" /> <br /> <input name="save_client_info" type="submit" value="Save" /> </div> </form> When the next button is used I would Like to Hide Div1 And Display Div2 so that it looks as if it is a new page. Any help would be greatly appreciated. I have identical code in my index that works, so I'm just guessing the error is somewhere else, I know IE is not the best target to aim for - but I really want this to work in the windows default browser.... Here is the php page... PHP Code: <HTML> <HEAD> <TITLE> Family Home Page </TITLE> <SCRIPT TYPE="text/javascript" SRC="AddFamilyMemeber.js"> </SCRIPT> </HEAD> <BODY> <TABLE> <TR> <TD>Father:</TD> <TD> <SELECT ID="Father"> <?PHP $con=mysql_connect("localhost","XXXX","XXXX"); if (!$con) { die('Could not connect: '.mysql_error()); } mysql_select_db("XXXX",$con); $result=mysql_query("SELECT * FROM FamilyMembers"); while ($row=mysql_fetch_array($result)) { echo "<OPTION VALUE=\"".$row['ID']."\">".$row['FirstName']." ".$row['MiddleName']." ".$row['LastName']."</OPTION>"; echo "<BR/>\n"; } mysql_close($con); ?> </SELECT> </TD> </TR> <TR> <TD>Mother:</TD> <TD> <SELECT ID="Mother"> <?PHP $con=mysql_connect("localhost","XXXX","XXXX"); if (!$con) { die('Could not connect: '.mysql_error()); } mysql_select_db("XXXX",$con); $result=mysql_query("SELECT * FROM FamilyMembers"); while ($row=mysql_fetch_array($result)) { echo "<OPTION VALUE=\"".$row['ID']."\">".$row['FirstName']." ".$row['MiddleName']." ".$row['LastName']."</OPTION>"; echo "<BR/>\n"; } mysql_close($con); ?> </SELECT> <TD> </TR> <TR> <TD>FirstName:</TD> <TD><INPUT TYPE="text" ID="FirstName"/></TD> </TR> <TR> <TD>MiddleName:</TD> <TD><INPUT TYPE="text" ID="MiddleName"/></TD> </TR> <TR> <TD>LastName:</TD> <TD><INPUT TYPE="text" ID="LastName"/></TD> </TR> </TABLE> <BUTTON TYPE="button" ONCLICK="Submit()">Submit</BUTTON> <BUTTON TYPE="button" ONCLICK="Abort()">Abort</BUTTON> </BODY> </HTML> and here is the javascript that works in the index but not here... Code: function Abort() { document.location="AddFamilyMember.php"; }; When I load the page everything looks ok, but click on the abort button, and all that happens is that the little error symbol pops in the lower left of IE. The names of the two files are "AddFamilyMember.php" and "AddFamilyMember.js". Sorry, but I honestly can't see where the problem is.... I am using 2 ajax functions in the program. One for login and one for logout. The login one is showUser which is working correctly by using the form onsubmit method, however the logout button (IN BOLD) onclick method is not working. Pls help. Code: <form onsubmit="showUser(document.getElementById('uid').value,document.getElementById('pass').value);return false;" > <div id="txt"><b>Enter your username </b> <input type="text" name= "username" id="uid"> <br> <b>Enter your password</b> <input type="password" name="pass" id="pass"> <br></div> <div id="txt1" style="display : none">help</div> <input type="submit" value="Login" /> <input type="button" onclick="logout(document.getElementById('uid').value); return false; " name="logout" value="Logout" /> <input type="button" value="Register" class="register"/> </form> |