Thread: selection box

  1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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.
    Here is the code


    <SCRIPT LANGUAGE="Javascript">
    browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) &#0124; &#0124; ((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");

    else if (myindex =="2"){

    else if (myindex == "3"){

    else if (myindex == "4"){'$[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"){'$[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");


    function Go()
    alert(" GO Function executed");

    <BODY bgcolor="#000000" link="#FFFFFF" VLINK="#FFFFFF" OnUnLoad="leave();" >

    <TABLE width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" valign="middle" align="center">
    <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>

    <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)">


  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    OnClick on the image "GO.gif" call this function &#0124; &#0124; 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;

    The index of "CHAT STUFF" is '0'(zero).

    (The others will be set to 'false'.)


Similar Threads

  1. List files in directory for choices in a selection box?
    By Bowser0001 in forum PHP Development
    Replies: 3
    Last Post: January 12th, 2004, 12:52 PM
  2. passing hidden fields based on list box selection
    By imiweb in forum HTML Programming
    Replies: 2
    Last Post: December 24th, 2003, 01:43 PM
  3. changing the buttons in the message box
    By crackerweb in forum Visual Basic Programming
    Replies: 6
    Last Post: October 23rd, 2003, 06:36 PM
  4. Disabling/Enabling by selection box
    By MikeRPGX in forum HTML Programming
    Replies: 1
    Last Post: September 28th, 2003, 01:51 PM
  5. Alert & stop submition when selection box is empty
    By philcp in forum HTML Programming
    Replies: 2
    Last Post: July 3rd, 2001, 04:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo