Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

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

innerHTML

  • Please log in to reply
7 replies to this topic

#1 farhad

farhad

    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 25 March 2010 - 07:32 AM

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>


  • 0

#2 James.H

James.H

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 569 posts

Posted 25 March 2010 - 09:51 AM

Can we a link where it works in FF ?
  • 0

#3 farhad

farhad

    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 25 March 2010 - 10:21 AM

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:
  • 0

#4 farhad

farhad

    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 26 March 2010 - 09:02 AM

can someone pleaaase help me out!
  • 0

#5 amrosama

amrosama

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2765 posts

Posted 29 March 2010 - 02:29 AM

i cant find that drop down on the link you posted
  • 0
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

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2765 posts

Posted 29 March 2010 - 02:36 AM

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

    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 29 March 2010 - 04:23 AM

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

thanks anyway.
  • 0

#8 amrosama

amrosama

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2765 posts

Posted 30 March 2010 - 01:55 PM

sorry i wish i noticed your thread earlier :)
  • 0
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





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download