1

I need JavaScript help!

Xenon Neko's Avatar Xenon Neko10/31/13 8:39 pm
1 emeralds 206 7
11/1/2013 9:19 pm
bmanrules's Avatar bmanrules
How do I check the input from an <input> tag with javascript? I already have this much: (Anything with a ? present is something I need help with.)

<form action="?" method="get">
Username: <input type="text">
<input type="submit" value="Submit">
</form>

How will I do this? Alslo, to be more specific, I want it to go to accountpass.joeminer.html if the input is "Joe_Miner".
Posted by Xenon Neko's Avatar
Xenon Neko
Level 25 : Expert Procrastinator
40

Create an account or sign in to comment.

7

1
11/01/2013 9:03 pm
Level 5 : Apprentice Taco
mastersnake77
mastersnake77's Avatar
HI!
1
11/01/2013 9:19 pm
Level 57 : Grandmaster Programmer
bmanrules
bmanrules's Avatar
Again, don't post if you can't help

Anyways, here's what you'll need (I recommend looking at javascript tutorials, because this is fairly basic stuff:
I don't know how you're handling the input or anything, but pass the string from the textbox into the test() function and do this:

var str = StringFromTextbox.toLowerCase();
str = str.replace('_', '');
window.location.href = str + ".html";
1
11/01/2013 8:55 pm
Level 25 : Expert Procrastinator
Xenon Neko
Xenon Neko's Avatar
Hello?
1
10/31/2013 9:00 pm
Level 25 : Expert Procrastinator
Xenon Neko
Xenon Neko's Avatar
How will I do this? Alslo, to be more specific, I want it to go to accountpass.joeminer.html if the input is "Joe_Miner".

Can you help with that?
1
10/31/2013 8:42 pm
Level 20 : Expert Archer
Gamecool 10
Gamecool 10's Avatar
Hey Joe Miner!

I would love to help you but....

I'm more experienced with Java than Javascript.

Sorry.....
1
10/31/2013 8:47 pm
Level 57 : Grandmaster Programmer
bmanrules
bmanrules's Avatar
Why did you post then?


Anyways, back on topic:

<input type="text" id="userInput"=>give me input</input>
<button onclick="test()">Submit</button>
<script>
function test()
{
var userInput = document.getElementById("userInput").value;
document.write(userInput);
}
</script>


Should run the test() function when submit is pressed after entering text!
1
10/31/2013 8:44 pm
Level 25 : Expert Procrastinator
Xenon Neko
Xenon Neko's Avatar
What's the difference?
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome