Jump to content

drop down menu to load a page

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
farhad

farhad

    Newbie

  • Members
  • Pip
  • 7 posts
Hi,

I´m trying to create a drop down menu that loads a page when a option is selected.
same as the php function "include("path")".

Please help me out. I have tried to create this simple function for hours. :confused:

#2
farhad

farhad

    Newbie

  • Members
  • Pip
  • 7 posts
never mind the problem is solved!

#3
farhad

farhad

    Newbie

  • Members
  • Pip
  • 7 posts
I´ll take that back... my solution only works with firefox, not IE,Safar,Chrome....

this is my 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ä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ä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>

PLEASE help me out =(

Edited by farhad, 24 March 2010 - 10:09 PM.
i was to fast


#4
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
There is a javascript forum a bit lower on the website ;)