SunQuest
           HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 22nd, 1999, 11:48 AM
yashika
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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>

Reply With Quote
  #2  
Old November 22nd, 1999, 11:45 PM
KingArtha
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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'.)


------------------

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > selection box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway