Drop down menu, load page on selected option

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fatroshi
    New Member
    • Dec 2009
    • 12

    Drop down menu, load page on selected option

    Hi,

    I´m trying to create a simple application with a drop menu.
    The drop menu should load a page inside the same page.
    Same as the php inlude("path") function.

    I´ve find one way to create this, but it´s only working in firefox!
    PLEASE help me out if you have few minutes.

    If you have a better way please do tell! =)

    Tanks!

    Code:
    <script type="text/javascript">
    function loadXMLDoc(url)
    {
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.open("GET",url,false);
    xmlhttp.send(null);
    document.getElementById('priser').innerHTML=xmlhttp.responseText;
    }
    </script>
    
    </head>
    
    <body>
    <h1><span class="redProdHeader"> Best&auml;llning av 
    affischer </span>  </h1>
    <form action="../tryckeri/form/offertTryckeriMail.php" method="post" name="offertTryckeri" id="offertTryckeri" enctype="multipart/form-data">
    
      <p><strong>Format:</strong><br />
        <select name="button" >
          <option>--- V&auml;lj Format ---</option>
          <option value="b2" ></option>
          <option value="a0" onclick="loadXMLDoc('../tryckeri/affischer/priser/A0Priser.php')">A0</option> 
          <option value="a1" onclick="loadXMLDoc('../tryckeri/affischer/priser/A1Priser.php')">A1</option>
          <option value="a2" onclick="loadXMLDoc('../tryckeri/affischer/priser/A2Priser.php')">A2</option>
          <option value="a3" onclick="loadXMLDoc('../tryckeri/affischer/priser/A3Priser.php')">A3</option>
          <option value="b1" onclick="loadXMLDoc('../tryckeri/affischer/priser/B1Priser.php')">B1</option>
          <option value="b2" onclick="loadXMLDoc('../tryckeri/affischer/priser/B2Priser.php')">B2</option>
          <option value="b2" ></option>
          <option value="offert" onclick="loadXMLDoc('../tryckeri/form/offertTryckeri.php')">Offert förfrågan</option>
        </select>
      </p>
      <br />
      <div id= "priser">
      </div>
Working...