?
Solved

How to auto launch a new page based on selection from a select (drop-down) box without a submit button

Posted on 2005-03-02
5
Medium Priority
?
159 Views
Last Modified: 2010-04-09
I think my question title says it all, but to put it another way -- how do I code a page so that a new page is automatically launched when a user selects from a drop-down rather than making the selection then hitting "submit".

Thanks.
0
Comment
Question by:scottie_24
  • 3
5 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 1000 total points
ID: 13444581
<select onchange="if(this.options[this.selectedIndex].value.length>0)location.href=this.options[this.selectedIndex].value">
<option value=""></option>
<option value="page1.html">page 1</option>
<option value="page2.html">page 2</option>
<option value="page3.html">page 3</option>
</select>
0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 13444623
Here is a DreamWeaver created sample page....

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1">
  <select name="menu1" onChange="jumpMenu('parent',this,0)">
    <option value="site1.com" selected>Site Description1</option>
    <option value="site2.com">Site Description2</option>
  </select>
</form>
</body>
</html>
0
 
LVL 32

Expert Comment

by:Batalf
ID: 13444655
My solution is the "notepad" solution:-)
0
 

Author Comment

by:scottie_24
ID: 13444656
Thanks Batalf. I gotta give the points to the first correct answer, sorry mgh_mgharish.
0
 
LVL 32

Expert Comment

by:Batalf
ID: 13444661
Thank you!

Batalf
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question