![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2006
Posts: 5
Rep Power: 0
![]() |
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? |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
OK, let's take a look at your code:
<script type="text/javascript">
<!--
function heh() {
var rawr = getElementById("name");
if (rawr.value == "tyler")
{
alert("Wow kid you're a little faggot!");
}
else
{
rawr.value = "*";
}
}
// -->
</script>Compare the two. And in future, please use [code] tags to make your code easier to read. |
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
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 ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FFT DWTIB -> Optimization -> Choosing An Appropriate Run Time | Sane | Software Design and Algorithms | 7 | Dec 1st, 2006 10:40 AM |
| Post&submit text to a form in java | long_john321 | Java | 3 | Aug 31st, 2005 2:54 PM |
| How to detect cursor location and insert text??? | syntax-error | C# | 3 | Jun 30th, 2005 1:42 AM |
| php/html: locking text box in a form | big_k105 | PHP | 3 | Jun 14th, 2005 3:59 PM |