Jump to content

[SOLVED] detect input text


ted_chou12

Recommended Posts

Thanks, this is what I got so far, but i cant get it to work:

<script type="text/javascript">
function check(what)
{
var length=what.nickname.value.length;	
if (length > 1)
document.getElementById("myButton1").value="New Button Text";
}
</script>

<form id="myform" method="post" action="" enctype="multipart/form-data">
<input type="button" value="Button Text" id="myButton1"></input>
<input type="text" id="tfield" value="" size="50" maxlength="300" onkeyup="check(this.id)" />
</form>

Ted

do it like this:

 

<script type="text/javascript">
function check(what)
{
   var length=document.getElementById(what).value.length;   
   if (length > 1)
   document.getElementById("myButton1").value="New Button Text";
}
</script>

<form id="myform" method="post" action="" enctype="multipart/form-data">
<input type="button" value="Button Text" id="myButton1"></input>
<input type="text" id="tfield" value="" size="50" maxlength="300"  />
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.