Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>window.open By Using onClick in <option> tag?

window.open By Using onClick in <option> tag?

Acid
02-04-2005, 11:25 AM
Wasn't sure is this was the right forum to post this in as it couldbe considered as either JavaScript or HTML really.

I'm creating an online ordering page using PHP, however there are a number of types of equipment that need to be order, in the case of three of them (laptop, mobile, printer) additional fields need to be displayed. So what I want to do is have a drop down list where the user selects the type of equipment and if they click on Laptop it redirects them to a page that has the same form but with all the laptop ordering extra fields as well. This will all be done as part of one file. Basically the PHP code to determine the laptop order page is:

<?php

if ($_GET['type'] == 'laptop') {
echo "<p>This is the laptop page.</p>";
}

?>

What I've tried for the drop down list is this:

<select name="type" id="type" />
<option value="Standard PC" selected="selected">Standard PC</option>
<option value="Laptop" onClick="window.location('index.php?id=order&amp;type=laptop');">Laptop</option>
</select>

But this isn't working. I could do this by entering the URL into the value attribute of the option tag, and then have the onchange event handler in the select tag, however i need to keep the value tags as plain text as this is needed by the rest of the PHP script. Also not all the options of the drop down list will redirect, of the ten or so options that will be in the list only three should redirect to specific pages. Can anyone think of a way i could have only those three options redirect to their individual pages when they're clicked on?

Any help with this would be great.
Cheers.

Acid
02-04-2005, 02:07 PM
Nevermind I've figured it out now.


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

contentEditable in Gecko
Problems with insertbefore method
Combine Hightlight with Add and Delete Selected Row
Change background for different resoloutions?
Document.getElementById() has no properties
Add and delete rows dynamically to an HTML table .... ?
script does not work on Mozilla FIrefox when doctype is on the html code
smart menu

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics