PDA

View Full Version : Javascript and textboxes



JK87
August 2nd, 2003, 04:32 AM
I imagine that DP will be the one to respond to this since he seems pretty clued up on Javascript right now. Basically, I was wondering what code would be required to do the following with Javascript :

You have a textbox which is not editable by the user. When the user moves the cursor over certain images, certain text/numbers should appear in the textbox.

e.g. If you move your mouse over image x.jpg, some text saying "Close the window" appears in the textbox. [note, that's just an example].

I know absolutely nothing when it comes to javascript so please try to explain it as well as possible :).

Thanks,
JK.

DigitalPimp
August 2nd, 2003, 04:53 PM
Well here you go. If you don't want to make it a textbox and say a SPAN or P tag then just change the slap the ID on it and match it up accordingly when you execute the function


<SCRIPT>
function chgText(obj) {
obj.innerText = "blah";
}
</SCRIPT>
<A href="javascript:chgText(textBlah);">Blah?</A>

<INPUT id="textBlah" type="text" value="RollOver a link" disabled>

JK87
August 3rd, 2003, 01:42 AM
I'll give it a whack. Cheers :).