Hi have made/making a function that checks if the the box has anything written in.
If something is entered a the word TICK comes up on the side.
Here is the function:
And here is the html:Code:<script> function checkInput(div_name) { if (this.value != '') { document.getElementById(div_name).style.display ='inline'; } else { document.getElementById(div_name).style.display ='none'; } } </script>
This function works when you type in something to the text box the word TICK comes up. The problem is that if you back space the word TICK is still there.Code:<table> <tr> <td width="200">First Name:</td> <td><input type="text" name="first_name" onKeyUp = "checkInput('fntick')"/></td> <td align="left"><div id="fntick" style="display:none;">TICK</div></td> </tr> </table>
This code below works fine but its not a function:
Code:<table> <tr> <td width="200">Last Name:</td> <td><input type="text" name="last_name" onKeyUp = "if (this.value != '') {document.getElementById('lntick').style.display = 'inline'; }else{document.getElementById('lntick').style.display = 'none'; }"/></td> <td align="left"><div id="lntick" style="display:none;">TICK</div></td> </tr> </table>
So if anyone can help fix my problem with the function.
Thanks


Reply With Quote

Bookmarks