PDA

View Full Version : Custom Keyword Redirect



deparkfire
11-26-2006, 05:33 PM
I am trying to add a box to my web page that the user can type in a KEYWORD and be directed to one of my pages based on the keyword. Example if they enter "tom" they will be dierected to www.tomboy.com or if they enter "apple" they are directed to www.apples.com. I downloaded a script a while back from the page but can not find it now. The script had a section where you typed out the keyword and where to redirect. Example
if keyword = "Tom" then goto "www.tomboy.com
if keyword = "apple then goto "www.apples.com
Etc.

Any help would be greatly appreciated.

Ges
11-26-2006, 08:31 PM
Hi deparkfire,
Here you go. I've made it case sensitive. Just add as many keywords as your heart desires!!



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>

<script type="text/JavaScript">
<!--
function Login(){
var done=0;
var keyword=document.enter_keyword.keyword.value;
//keyword=keyword.toLowerCase();
if (keyword=="Tom") { window.location="http://www.tomboy.com"; done=1; }
if (keyword=="apple") { window.location="http://www.apples.com"; done=1; }
if (keyword=="orange") { window.location="http://www.oranges.com"; done=1; }
if (done==0) { alert("WARNING:Incorrect keyword you plonker!!!"); }
}
//-->
</script>

</head>

<body>

<form name=enter_keyword>
<table border="1" cellpadding="2" cellspacing="2" bgcolor="#7B97E0">
<tr>
<td>
<font color="#ffffff"><b>Enter keyword:</b></font>
</td>
<td><input type=text name=keyword>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button value="Login!" onClick="Login()">
</td>
</tr>
</table>
</form>

</body>
</html>



Hope this helps.
Regards,
Ges.

deparkfire
11-26-2006, 08:59 PM
THANK YOU THANK YOU THANK YOU
This is exaclty what I was looking for.:)

jgold501
02-05-2007, 06:04 PM
hi i tried the script on Custom Keyword Redirect below and i cant get it to work in internet explorer it works only in firefox,,can you help me ??

james

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>

<script type="text/JavaScript">
<!--
function Login(){
var done=0;
var keyword=document.enter_keyword.keyword.value;
//keyword=keyword.toLowerCase();
if (keyword=="Tom") { window.location="http://www.tomboy.com"; done=1; }
if (keyword=="apple") { window.location="http://www.apples.com"; done=1; }
if (keyword=="orange") { window.location="http://www.oranges.com"; done=1; }
if (done==0) { alert("WARNING:Incorrect keyword you plonker!!!"); }
}
//-->
</script>

</head>

<body>

<form name=enter_keyword>
<table border="1" cellpadding="2" cellspacing="2" bgcolor="#7B97E0">
<tr>
<td>
<font color="#ffffff"><b>Enter keyword:</b></font>
</td>
<td><input type=text name=keyword>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button value="Login!" onClick="Login()">
</td>
</tr>
</table>
</form>

</body>
</html>

Ges
02-05-2007, 09:50 PM
WHEN WILL CRAPPY ADVERTISERS LEARN HOW TO MARKET IN A PROFESSIONAL WAY?

MODERATOR - COULD YOU REMOVE THE POST FROM jgold501 AS ANYONE CAN SEE THAT THE SCRIPT WORKS ON ALL BROWSERS JUST BY LOOKING AT IT.

MEMBERS - DON'T EVEN TRY HIS CODE AS IT WILL PROBABLY LEAD YOU TO SOME ADWARE ETC.