Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-29-2006, 04:56 PM   PM User | #1
sir pannels
Regular Coder

 
Join Date: Jun 2002
Posts: 905
Thanks: 23
Thanked 5 Times in 5 Posts
sir pannels is an unknown quantity at this point
onclick textfield input help

yo all,

need some help with javascript .. I have an onclick event, within it I have a line that reads ..

Code:
textfield1.value="GO";
The textfield1 is on the page however when I click to get the onclick event to move, the page errors, it says 'textfield1 is undefined. I'm not a javascript coder, just play around .. do I need to define the textfield somewhere else?

Any info would be great,

cheers,
Sir P
sir pannels is offline   Reply With Quote
Old 06-29-2006, 05:47 PM   PM User | #2
arnyinc
Regular Coder

 
Join Date: Jan 2003
Posts: 867
Thanks: 4
Thanked 8 Times in 8 Posts
arnyinc is an unknown quantity at this point
<form>
<input type="text" name="textfield1"><br>
<input type="button" onclick="this.form.textfield1.value='GO'">
</form>
arnyinc is offline   Reply With Quote
Old 06-29-2006, 05:49 PM   PM User | #3
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
try this:

<script>
function MyClickEvent(){

document.myFormName.MyFieldName.value="GO";

}
</script>

<form name='myFormName'>
<input type='text' name='MyFieldName' onClick='MyClickEvent();' />
</form>
angst is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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


All times are GMT +1. The time now is 04:48 AM.


Advertisement
Log in to turn off these ads.