Reply to Re: Help this javascript

Your name:

Reply:


Posted by Toby Inkster on 02/25/06 11:03

ken wrote:

> <SCRIPT LANGUAGE="JavaScript">

The "language" attribute has been obsolete for quote some time. Use:

<script type="text/javascript">

> function formHandler(form){
> var URL =document.form.site.options[document.form.site.selectedIndex].value;
> window.location.href = URL;}

Nasty. Use:

function formHandler ()
{
var sel = document.getElementById('site');
var url = site.options[site.selectedIndex].value;
window.localtion.href = url;
}

> </script>
>
> <form name="form">
> <select name="site" size=1 onChange="javascript:formHandler2()">

Replace these two with:

<form action="redirect.php" method="GET">
<div>
<select name="site" id="site" onchange="formHandler();">

> <option value="">Enrollment, Fees, Policies
> <option value="enrollment.html">Enrollment
> <option value="ssh_policies.html">School Policies & Fees

"&" here should be replaced with "&amp;".

> <option value="schedule.html">Group Class Schedule
> </select>

Now add:

<noscript>
<input type="submit" value="Go">
</noscript>
</div>
</form>

And create "redirect.php" to handle those visitors who have Javascript
disabled. Here's a basic "redirect.php".

<?php
$url = $_GET['site'];
if (!preg_match('#http://#', $url))
$url = "http://{$_SERVER['HTTP_HOST']}/{$url}";
header("Location: $url");
?>

It assumes that your host supports PHP.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация