...

View Full Version : onclick textfield input help



sir pannels
06-29-2006, 04:56 PM
yo all,

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



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

arnyinc
06-29-2006, 05:47 PM
<form>
<input type="text" name="textfield1"><br>
<input type="button" onclick="this.form.textfield1.value='GO'">
</form>

angst
06-29-2006, 05:49 PM
try this:

<script>
function MyClickEvent(){

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

}
</script>

<form name='myFormName'>
<input type='text' name='MyFieldName' onClick='MyClickEvent();' />
</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum