Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 3rd, 2007, 1:24 AM   #1
Phonetic
Newbie
 
Join Date: Nov 2006
Posts: 5
Rep Power: 0 Phonetic is on a distinguished road
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?
Phonetic is offline   Reply With Quote
Old Apr 3rd, 2007, 1:39 AM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 3rd, 2007, 6:12 AM   #3
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
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
Arevos is offline   Reply With Quote
Old Apr 6th, 2007, 7:53 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Apologies - failed to spot that one. And no, they're not, but damn, do they make things easier to read.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:02 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC