• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

html question **another update, and plz try the link**

Boonesmi

Lifer
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"
 

joinT

Lifer
Jan 19, 2001
11,172
0
0
do you have a link to your page so far or ?
I'm thinking JavaScript for this.. Try searching hotscripts.com or javascript.internet.com
 

Boonesmi

Lifer
Feb 19, 2001
14,448
1
81
nope i dont have a link (its basically just an idea i was trying to work out)

its for my brother in laws site, he wants people to be able to type in their name and have it take them to a .html that was created for them

ie. grandma types in "grandma" and it takes her to http://www.myhomepage.com/grandma/index.html
or robert types in "robert" and it takes to http://www.myhomepage.com/robert/index.html

all of the index.html pages will obviously already be created in advance
and it will only work for people who have already had a page created for them


joinT tks for the links... ill try searching them :)
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
<input type="text" name="stuff"> <button onclick="document.location.href='http://foo/'+stuff.value;">

something like that.
 

Boonesmi

Lifer
Feb 19, 2001
14,448
1
81
ahhh tks!!!
that works perfectly :)


sorry for being such a noob, but how would i add text to the button (instead of just a plain button, i want it to say something like "click me!"


 

Ulukai

Member
Nov 29, 2003
28
0
0
Edit: lmao, forgot to add and bold the parts you asked for, disregard this you got it.
 

Boonesmi

Lifer
Feb 19, 2001
14,448
1
81
ok a new problem :(

it doesnt seem to work in mozilla... i updated the original post to explain the problem
 

xcript

Diamond Member
Apr 3, 2003
8,258
2
81
Originally posted by: Boonesmi
ok i got a new problem... the code doesnt seem to work in mozilla???
Try something like this:

<form name="foo">
<input type="text" name="bar"><input type="button" value="login" onclick="document.location=foo.bar.value;">
</form>


Works fine in Firebird for me.
 

Boonesmi

Lifer
Feb 19, 2001
14,448
1
81
ahh tks!! that one is working in mozilla :)

slight problem though, anyone know how to make it so the "enter" key will do the same thing as clicking "login"?

currently if you type in some text and click "login" it works great (in both mozilla and IE) but if you type in text and hit "enter" it does some weird thing and reloads the page (it does this in both mozilla and IE)
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: Boonesmi
ahh tks!! that one is working in mozilla :)

slight problem though, anyone know how to make it so the "enter" key will do the same thing as clicking "login"?

currently if you type in some text and click "login" it works great (in both mozilla and IE) but if you type in text and hit "enter" it does some weird thing and reloads the page (it does this in both mozilla and IE)

put the whole thing in a form, replace the <button with <submit and make the form onsubmit event do what the onclick event used to do.
 

Boonesmi

Lifer
Feb 19, 2001
14,448
1
81
i updated my original post with the new code and info
here is a link for testing (i just set this up to quickly test it)
its currently setup for 2 login names "happy" and "gilmore"


any of you guys use a mac? or other browsers? if so plz let me know if it works right (ive had a heck of a time getting something that works right in mozilla, but this one seems to be working :D )

tks :)
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: Boonesmi
i updated my original post with the new code and info
here is a link for testing (i just set this up to quickly test it)
its currently setup for 2 login names "happy" and "gilmore"


any of you guys use a mac? or other browsers? if so plz let me know if it works right (ive had a heck of a time getting something that works right in mozilla, but this one seems to be working :D )

tks :)

If the logins are supposed to be private, I STRONGLY recommend not doing it that way. Otherwise, looks fine.