setting the value of a textbox problem

I

ii2o

Hi guys, I want to set the value of a textbox when someone hovers over
an image (which is hyperlinked) but to no avail. Can anyone spot the
problem here? I've wittled the code down to it's bare minimum so you
can try copying and pasting it into an htm file. Thanks a lot!

(At first I thought it might have been a scope problem in that the <a>
tag had to be within the <form> tag but that doesn't work either -
perhaps the onmouseover doesn't work with hyperlinked images?)

<html>
<head>
<script language="javascript">
function setInfoBox(tV1, tV2, tV3) {
document.infoboxform.infoBox.value = tV1 + " :: " + tV2;
}
function clearInfoBox {
document.infoboxform.infoBox.value = "";
}

</script>
</head>

<body>

<form name="infoboxform">
<input class="textbox" name="infoBox" value="Hello!" type="text"
style="text-align:center;">
</form>

<a href="index.htm" onmouseover="setInfoBox('Value 1', 'Value 2',
'Value 3')">
<img style="border: 0px"
src="http://images.amazon.com/images/P/B00006KGSG.01.LZZZZZZZ.jpg"
alt="hi!" width="30" height="30" border="1">
</a>

</body>
</html>
 
W

web.dev

ii2o said:
<script language="javascript">

The language attribute is deprecated, use the type attribute instead:

function clearInfoBox {

:) A simple oversight! Looks like you forgot to add in function
parameters. Putting that in appears to fix it.

function clearInfoBox () {
^
 
L

Lee

ii2o said:
function clearInfoBox {
document.infoboxform.infoBox.value = "";
}

function clearInfoBox() {

You need the open/close parens, even if you don't have any formal
parameters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top