Web Analytics Made Easy -
StatCounter Select Box, Doesn't Work In IE - CodingForum

Announcement

Collapse
No announcement yet.

Select Box, Doesn't Work In IE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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!||||

    Comment


    • #3
      In IE it is still opening

      newpm.php?fto=

      rather than

      newpm.php?fto=username

      Comment


      • #4
        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!||||

        Comment


        • #5
          Still the same.

          Works in firefox but not IE

          Comment


          • #6
            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!||||

            Comment

            Working...
            X