Jump to content

drop down menu - that loads page in the same page!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 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")".

The code below works only for firefox :confused: not for IE, safari, chrome
Please help me out. I have tried to create this simple function for hours.


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




#2
James.H

James.H

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 866 posts
Can we a link where it works in FF ?

#3
farhad

farhad

    Newbie

  • Members
  • Pip
  • 7 posts

James.H said:

Can we a link where it works in FF ?

Sure, Tryckeri I Järfälla | FL Neodesign

Thanks, I need all the help I can get. :rolleyes:

#4
farhad

farhad

    Newbie

  • Members
  • Pip
  • 7 posts
can someone pleaaase help me out!

#5
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
i cant find that drop down on the link you posted
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#6
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
anyways, never use onclick event for "option" tags. use the "change" event of the "select" tag instead and make a "switch" or "if" statement on the select value.
i think thats your problem plus people who only use keyboard (disabled or lazy people who dont want to reach for their mouse) will be able to load your content
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#7
farhad

farhad

    Newbie

  • Members
  • Pip
  • 7 posts
thanks for the replay, I removed it and solved it with taps instead. I took while to get help hehe

thanks anyway.

#8
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
sorry i wish i noticed your thread earlier :)
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript