|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi all:
In the below selection box, when i select an option, the respective code is executed, but after that, the option in the selection box remains the same, so the onchange event does not work with the same option. so what i want is, i need to change the option again to the 1st value which is declared selected in the option box in this case(chat stuff).I have tried with onchange event on selection box or onclick event for go button . Either of them is fine with me. how do i do that, pls let me know. Thanks Here is the code <html> <head> <title>Untitled</title> </head> <SCRIPT LANGUAGE="Javascript"> <!-- browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) | | ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))) function surfto(form) { var myindex=form.select1.selectedIndex if (myindex == "0"){ alert("Choose one option"); } else if (myindex == "1"){ alert("Chose users option"); showAllUsersWindow(); } else if (myindex =="2"){ showMainRoomWindow(); } else if (myindex == "3"){ showHelpWindow(); } else if (myindex == "4"){ window.open('$[links.html]', '', 'resizable=yes,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,directories=no,width=260,h eight=260'); } else if (myindex == "5"){ window.open('$[chattips.html]','', 'resizable=yes,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,directories=no,width=580,h eight=350'); } else if (myindex == "6"){ alert("you chose to exit"); top.window.close(); Leave(); } } function Go() { alert(" GO Function executed"); } </script> <BODY bgcolor="#000000" link="#FFFFFF" VLINK="#FFFFFF" OnUnLoad="leave();" > <TABLE width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" valign="middle" align="center"> <TR> <form name="form" method="post" action="controlsrc.htm"> <td align="left" valign="left"> <div align="center"> <select name = "select1" size=1 onchange="surfto(this.form)" > <option selected value="0" ><b>CHAT STUFF</b></option> <option value="1">USERS</option> <option value="2"><strong>ROOMS</strong> </option> <option value="3"><strong>HELP</strong></option> <option value="4"><strong> SITES</strong></option> <option value="5"><strong>CHAT TIPS</strong></option> <option value="6"><strong>EXIT</strong></option> </select> </div> </td> <td align="left" valign="top"> <div align="left"> <INPUT Type=image border="0" src="/eshare/files/templates/htmlclient/client_images/Go.gif" onclick="surfto(this.form)"> </div> </td> </TR> </form> </TABLE> </BODY> </HTML> </body> </html> |
|
#2
|
|||
|
|||
|
Hi!
OnClick on the image "GO.gif" call this function | | try calling it after the sixth selection. function setDefault() { select1.options(def).selected = 'true'; } "def" is the index of the default value in the select list; Ex: The index of "CHAT STUFF" is '0'(zero). (The others will be set to 'false'.) ------------------ |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > selection box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|