Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 02-04-2009
Join Date: Aug 2008
Posts: 46
URL Option With Button in HTML

In this program when the user selects an option in the select object, the loadPage() function is invoked by the onclick event handler of button, passing the select object as an argument. The URL associated with each option is stored as the option's value attribute, or value property in terms of javascript. The selected option is list.options[list.selectedIndex] becuase list.selectedIndex is an integer represented the index of the selected option. The value property is used property is used to access the URL of the selected object,which is then to assigned to loaction.href, in order ti load the page to the browser window.

<title>Url Option With Button</title>
function loadPage(list)'user defined function loadPage() called when the user clicks on button
location.href=list.options[list.selectedIndex].value'helps in changing the page from the cuurent to what is selected on the basis of selected index.
<option value="http://www.cnn.com/">cnn'option with address of cnn website
<option value="http://www.rediff.com/">Rediff
<option value="http://www.msn.com/">Msn
<option value="http://www.Yahoo.com/">Yahoo
<input type="button" value="load page" onclick="loadPage(this.form.elements[0])">
Reply With Quote

  TechArena Community > Software > Software Development
Tags: ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "URL Option With Button in HTML"
Thread Thread Starter Forum Replies Last Post
Ridge Racer Unbounded has a drift button and no option for playing 12 players online Non-$ensoi Video Games 5 01-04-2012 04:59 PM
False Positive on the Facebook Like button ?HTML/Infected.WebPage.Gen2? Ro-Man Networking & Security 4 28-05-2011 05:53 PM
I want image instead of Back and Foward button in HTML Kasper Software Development 4 11-02-2010 07:27 PM
how to i get html codes to run onclick of a button? cordless33 Software Development 7 05-05-2009 09:53 AM
How can I display image on a button with pure HTML? JangoRap Software Development 3 16-02-2009 08:14 PM

All times are GMT +5.5. The time now is 10:12 AM.