![]() |
Using form text values?
<head>
<script type="text/javascript"> function heh() { var rawr = getElementById("name") if ("name == tyler") alert("Wow kid you're a little faggot!") } else("name == * ") } } </script> </head> <body> <form> ENTER YOUR NAME!!!<input type="text" id="name" value=""> <input type="submit" value="CLICK ME!" onclick="heh()"> </form> </body> Sigh I was wondering if anyone would know how to take the value information from the text input and use it to create and alert, or just to call on the information whenever I need it? This is a script I put together to show what I thought would be how it's done, but it's not. Anyway can someone help me? |
OK, let's take a look at your code:
:
<script type="text/javascript">Compare the two. And in future, please use [code] tags to make your code easier to read. |
Shouldn't that be document.getElementById?
Also, semicolons aren't strictly necessary in ECMAScript. Finally, could we perhaps in future refrain from using potentially offensive profanity in examples? Thanks :) |
Apologies - failed to spot that one. And no, they're not, but damn, do they make things easier to read. :)
|
| All times are GMT -5. The time now is 2:09 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC