By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,566 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,566 IT Pros & Developers. It's quick & easy.

setting the value of a textbox problem

P: n/a
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>

Dec 9 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

ii2o wrote:
<script language="javascript">
The language attribute is deprecated, use the type attribute instead:

<script type = "text/javascript">
function clearInfoBox {


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

function clearInfoBox () {
^

Dec 9 '05 #2

P: n/a
Thank you so much!!! I've been pulling my hair out for the last 2 hours
over it!

Dec 9 '05 #3

P: n/a
On 2005-12-09, ii2o <ii**@hotmail.com> wrote:
Thank you so much!!! I've been pulling my hair out for the last 2 hours
over it!


what sort of error messages were you seeing?

to see errors:

In mozilla do tools->web development->javascript console
In IE click on the little yellow doohickey that appears in the status bar.
(then click details, and always show... - don't worrys ist just as easy to
turn alwys show off when you've finished debugging)

Bye.
Jasen
Dec 10 '05 #4

P: n/a
On 2005-12-09, ii2o <ii**@hotmail.com> wrote:
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!
needs () here --------.
| function clearInfoBox {
document.infoboxform.infoBox.value = "";
}

Bye.
Jasen
Dec 10 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.