Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Location
    Dumfries, Scotland
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select Box, Doesn't Work In IE

    Code:
    function sendpm()
      {
       var top = window.document.pm.fto.selectedIndex;
       var topi = window.document.pm.fto.options[top].value;
       loc = "newpm.php?fto=" + topi;
       window.open(loc,"pm","height=340,width=629");
      }
    I have a select box with a list of username's taking from a database using PHP enclosed in a form and am using this funciton in the onSubmit to open a new window when the form is submitted.

    It works ok in firefox but not IE

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I have a feeling it might be your variable names. It could be reserved or something. Try this
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title></title>
    <script type="text/javascript">
    function sendpm()
    {
    	var ftoindex = window.document.pm.fto.selectedIndex;
    	var ftoindexi = window.document.pm.fto.options[ftoindex].value;
    	var loc = "newpm.php?fto=" + ftoindexi;
    	window.open(loc,"pm","height=340,width=629");
    	return false;
    }
    </script>
    </head>
    
    <body>
    <form name="pm" onsubmit="return sendpm()">
    <select name="fto">
    <option value="123" selected="selected">123</option>
    <option value="456">456</option>
    </select><input type="submit" value="Submit">
    </form>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Location
    Dumfries, Scotland
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In IE it is still opening

    newpm.php?fto=

    rather than

    newpm.php?fto=username

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Try
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title></title>
    <script type="text/javascript">
    function sendpm()
    {
    	var theform = document.forms['pm'].fto.options;
    	var ftoindex = theform.selectedIndex;
    	var ftoindexi = theform[ftoindex].value;
    	var loc = "newpm.php?fto=" + ftoindexi;
    	window.open(loc,"pm","height=340,width=629");
    	return false;
    }
    </script>
    </head>
    
    <body>
    <form name="pm" onsubmit="return sendpm()">
    <select name="fto">
    <option value="123" selected="selected">123</option>
    <option value="456">456</option>
    </select><input type="submit" value="Submit">
    </form>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New to the CF scene
    Join Date
    Sep 2006
    Location
    Dumfries, Scotland
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Still the same.

    Works in firefox but not IE

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Are you sure there is even a selected value? The first value shown is just shown it doesn't mean its selected. You need to actually set a default value using selected="selected".
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •