Interland: Free Setup + Up To $500 off on Advanced Dedicated Hosting plans featuring IBM eServers.

WebProWorld Dev Forum

Is there a Page Loading Script someone has?
I'm looking for a simple Page Loading script that opens in another small window...

Web counter
I'd like to know where can i find a good web counter for my web site! ...

Recent Articles

Less is More for University Websites
Many university websites are poorly organized, and filled with out-of-date content that has been directly published from print.

Less is More For Government Websites
Many governments have so far approached the Web with a rather crude strategy of getting every service online.

09.22.04

JavaScript: Redirecting URL

By Amrit Hallan

Whenever you want to generate dynamic pages you often have to resort to using some server side scripting language such as PHP or ASP.

But let us assume that there are only three or four pages that could be chosen from a drop-down menu (a combo-box). The following procedure helps you create a JavaScript-supported drop-down menu.

First the form:

<form name=="pages">
<select name=="pg_choice" onChange=="javascript: take_there();">
<option value=="no_page">Select a page to go to...</option>
<option value=="pg1.html">Page 1</option>
<option value=="pg2.html">Page 2</option>
<option value=="pg3.html">Page 3</option>
</select>
</form>


This form presents to you three choices of pages. In its onChange attribute we decide what function to call to be re-directed to the respective page. And now the JavaScript (note that I have inserted a dot between < and script so that your email reader doesn't object to the presence of an embedded JavaScript in your message):

Make more money from your site traffic, on your terms. >> start here

<.script language=="javascript">

function take_there()
{
    var destination==document.pages.pg_choice.value;
    var version == navigator.appVersion;
    // sets variable == browser version
    if(destination!=="no_page")
    {
      if (version.indexOf("MSIE") >== -1)
      // checks to see if using IE
      {
         window.location.href=̃stination;
      }
      else
      {
         window.open(destination, target=="_self");
      }
    }
}

</script>


Different browsers support different things so quite often you have to check what browser the user is using. The page redirection command is used accordingly.


About the Author:
Amrit Hallan is a web designer and developer. He has experience in developing PHP-MySQL applications as well as simple HTML websites. Visit his website -- http://www.bytesworth.com to read more articles and see the kind of work he does.

About TheDevWeb
TheDevWeb examines the best tools and techniques to help you keep up with all the latest trends in the fast paced world of web development. Excellence in Development Starts Here

TheDevWeb is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITCertificationNews.com


-- TheDevWeb is an iEntry, Inc. publication --
iEntry, Inc. 880 Corporate Drive, Lexington, KY 40503
2004 iEntry, Inc. All Rights Reserved Privacy Policy Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

Excellence in Development Starts Here TheDevWeb News Archives About Us Feedback TheDevWeb Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact