![]() ![]() |
| dinocolato |
Nov 21 2011, 04:40 AM
Post
#1
|
|
Newbie ![]() Group: Members Posts: 14 Joined: 8-April 10 Member No.: 11,605 |
hi all,
I have a span tags in a html page near a text field. If I digit a word in with caps lock enable I show a message near the field. But my page has 3 fields and 3 span tags. If I digit a word in with caps lock enable a message will be shown near the first field only. How can I show the message only near the text file that I typing in? Javascript if (condition) document.getElementById('mySpan').style.visibility = 'visible'; else document.getElementById('mySpan').style.visibility = 'hidden'; HTML <input type="text" name="myname" onkeypress="capsLock(event)" /><span id="mySpan" style="visibility:hidden;">Warning</span> <input type="text" name="myname" onkeypress="capsLock(event)" /><span id="mySpan" style="visibility:hidden;">Warning</span> <input type="text" name="myname" onkeypress="capsLock(event)" /><span id="mySpan" style="visibility:hidden;">Warning</span> |
| pandy |
Nov 21 2011, 05:52 AM
Post
#2
|
|
Don't like donuts. Don't do MySpace. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: WDG Moderators Posts: 13,723 Joined: 9-August 06 Member No.: 6 |
You must give the SPANs different ID's and pass that ID to the function I suppose you have.
FYI an ID is supposed to be unique for a page. You can use the same one only once. -------------------- |
![]() ![]() |
|
Lo-Fi Version | Time is now: 20th May 2013 - 03:28 PM |