PDA

View Full Version : Simple Search Script : JavaScript Please Help


slephnir
05-21-2004, 08:33 AM
Hi,

I am writing a simple JavaScript to take a string and match it, when a matching string is received the browser is supposed open a new page called newpage.html.

At the moment the browser executes the code without syntax errors but it will not bring up the new page "newpage.html" as it is supposed to.

If anyone can have a look at this code and tell me what I am doing wrong, it would be very helpful.

<html>
<head>
<title>document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JAVASCRIPT">
function search(){
var search = a;
search = document.search.textfield;
if (search == 'a') { location = "newpage.html" }
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name=search method=POST onSubmit="return validate(search)";>
<P>Please enter a search keyword</p>
<input type="text" name="textfield">
<input type="submit" name="Submit" value="Submit" onClick=" search()">
</form>
</body>
</html>

:confused:

iSilo
05-21-2004, 09:00 AM
This does not seem like a tip or trick, but we'll let it pass this time.

If by "browser", you mean iSilo, then it is the case that iSilo does not support JavaScript, so what you are trying to do will not work with iSilo.