- Feb 19, 2001
- 14,448
- 1
- 81
any of you guys know what code i could use to get the following to work right?
i want to add a little form where the user can input text and when hitting the submit button it will take him/her to a page that has that same text in the url
for example:
the user types in "happy" and when hitting the button it takes him to http://mypage.com/happy
or if the user enters "toybox" it takes him to http://mypage.com/toybox
any help would be much appreciated
***UPDATE*** FEB 21ST
ok i got a new problem... the code doesnt seem to work in mozilla??? (it works in internet explorer no problem)
can anyone take a look at my code and see whats wrong?
and tks CTho9305 for the hint on how to do the code
ive tried several variations and they dont do anything in mozilla (click the button and nothing happens)
**************************************************
<CENTER><FONT FACE="comic sans ms" SIZE="6" COLOR="#000000">Please Enter Username</FONT> </CENTER>
<center>
<input type="text" name="stuff"> <input type="button" value="Login" onclick="parent.location=''+stuff.value;">
</center>
*************************************************
***UPDATE*** FEB 25TH
incase anyone is interested
i ended up finding a javascript at "javascript.internet.com" and modifying it to do what i needed (basically just removed passwords and some other small stuff)
here is the new code (the bulk of it, all of the top part goes in the <head> and just the single bottom line goes in the <body>
*********************************
<SCRIPT LANGUAGE="JavaScript">
function LogIn()
{
loggedin=false;
username="";
username=prompt("Username:","");
username=username.toLowerCase();
if (username=="happy") {loggedin=true;document.location="happy/";}
if (username=="gilmore") {loggedin=true;document.location="gilmore/";}
if (loggedin==false) {alert("Invalid login!");}
}
// End -->
</SCRIPT>
<center>
<form><input type=button value="Login" onClick="LogIn()"></form>
</center>
***********************************
here is a link to show how it works (i just set this one up so i could test the code with different browsers) plz let me know if any of you guys notice any problems with it
its got 2 logins:
"happy" and "gilmore"
i want to add a little form where the user can input text and when hitting the submit button it will take him/her to a page that has that same text in the url
for example:
the user types in "happy" and when hitting the button it takes him to http://mypage.com/happy
or if the user enters "toybox" it takes him to http://mypage.com/toybox
any help would be much appreciated
***UPDATE*** FEB 21ST
ok i got a new problem... the code doesnt seem to work in mozilla??? (it works in internet explorer no problem)
can anyone take a look at my code and see whats wrong?
and tks CTho9305 for the hint on how to do the code
ive tried several variations and they dont do anything in mozilla (click the button and nothing happens)
**************************************************
<CENTER><FONT FACE="comic sans ms" SIZE="6" COLOR="#000000">Please Enter Username</FONT> </CENTER>
<center>
<input type="text" name="stuff"> <input type="button" value="Login" onclick="parent.location=''+stuff.value;">
</center>
*************************************************
***UPDATE*** FEB 25TH
incase anyone is interested
i ended up finding a javascript at "javascript.internet.com" and modifying it to do what i needed (basically just removed passwords and some other small stuff)
here is the new code (the bulk of it, all of the top part goes in the <head> and just the single bottom line goes in the <body>
*********************************
<SCRIPT LANGUAGE="JavaScript">
function LogIn()
{
loggedin=false;
username="";
username=prompt("Username:","");
username=username.toLowerCase();
if (username=="happy") {loggedin=true;document.location="happy/";}
if (username=="gilmore") {loggedin=true;document.location="gilmore/";}
if (loggedin==false) {alert("Invalid login!");}
}
// End -->
</SCRIPT>
<center>
<form><input type=button value="Login" onClick="LogIn()"></form>
</center>
***********************************
here is a link to show how it works (i just set this one up so i could test the code with different browsers) plz let me know if any of you guys notice any problems with it
its got 2 logins:
"happy" and "gilmore"
