![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Am I missing something simple? I can't figure this one out... script language="JavaScript" type="text/javascript" function showDesc(desc) { showDescription.innerText = desc; } /script img src="images/products/item1.gif)#" width="75" height="75" border="0" onMouseOver="showDesc('prodName');" onMouseOut="showDesc('Mouse over image for product name')" |
#3
| |||
| |||
|
|
Am I missing something simple? I can't figure this one out... |
|
script language="JavaScript" type="text/javascript" |
|
function showDesc(desc) { showDescription.innerText = desc; |
#4
| |||
| |||
|
|
If it is an ID, first make a variable: var showDescription = getElementById("showDescription") |
#5
| |||
| |||
|
|
Dru <Dontemailme (AT) comcast (DOT) net> writes: Am I missing something simple? I can't figure this one out... You are missing two simple things (and the standard completely). script language="JavaScript" type="text/javascript" (The language attribute is not needed, but is not incorrect in HTML 4 Transitional). function showDesc(desc) { showDescription.innerText = desc; You are using a (probably global) variable called "showDescription". If you haven't declared it, it won't be there in FireFox (or many other browsers). I guess you want it to refer to an element with the name or id "showDescription". IE creates variables referring to named elements, but it's not part of any standard, and many other browsers don't. It's a FAQ entry: URL:http://jibbering.com/faq/#FAQ4_41 You also use the property "innerText", which is a proprietary IE feature. It won't work in most other browsers, including FireFox. You can either use the more widely implemented, but just as proprietary, innerHTML property, or you can use W3C DOM methods. URL:http://jibbering.com/faq/#FAQ4_15 /L |
#6
| |||
| |||
|
|
var showDescription = getElementById("showDescription") You forgot to qualify the method with "document.". The call will error without it. |
#7
| |||
| |||
|
|
Dru <Dontemailme (AT) comcast (DOT) net> writes: Am I missing something simple? I can't figure this one out... You are missing two simple things (and the standard completely). script language="JavaScript" type="text/javascript" (The language attribute is not needed, but is not incorrect in HTML 4 Transitional). function showDesc(desc) { showDescription.innerText = desc; You are using a (probably global) variable called "showDescription". If you haven't declared it, it won't be there in FireFox (or many other browsers). I guess you want it to refer to an element with the name or id "showDescription". IE creates variables referring to named elements, but it's not part of any standard, and many other browsers don't. It's a FAQ entry: URL:http://jibbering.com/faq/#FAQ4_41 You also use the property "innerText", which is a proprietary IE feature. It won't work in most other browsers, including FireFox. You can either use the more widely implemented, but just as proprietary, innerHTML property, or you can use W3C DOM methods. URL:http://jibbering.com/faq/#FAQ4_15 /L |
#8
| |||
| |||
|
|
Dru <Dontemailme (AT) comcast (DOT) net> writes: Am I missing something simple? I can't figure this one out... You are missing two simple things (and the standard completely). script language="JavaScript" type="text/javascript" (The language attribute is not needed, but is not incorrect in HTML 4 Transitional). function showDesc(desc) { showDescription.innerText = desc; You are using a (probably global) variable called "showDescription". If you haven't declared it, it won't be there in FireFox (or many other browsers). I guess you want it to refer to an element with the name or id "showDescription". IE creates variables referring to named elements, but it's not part of any standard, and many other browsers don't. It's a FAQ entry: URL:http://jibbering.com/faq/#FAQ4_41 You also use the property "innerText", which is a proprietary IE feature. It won't work in most other browsers, including FireFox. You can either use the more widely implemented, but just as proprietary, innerHTML property, or you can use W3C DOM methods. URL:http://jibbering.com/faq/#FAQ4_15 /L |
#9
| |||
| |||
|
|
there is a div called showDescription that I left out of my first post .. changing the innerText to innerHTML doesn't seem to help Firefox. |
|
I'm just going to have to read up on the FAQs and probable a good JS book. |

#10
| ||||
| ||||
|
|
this is inside a .js file so the <script language="javascript"> isn't needed. |
|
there is a div called showDescription that I left out of my first post ... changing the innerText to innerHTML doesn't seem to help Firefox. |
|
I'm just going to have to read up on the FAQs and probable a good JS book. |
|
On Sun, 04 Apr 2004 18:59:49 +0200, Lasse Reichstein Nielsen lrn (AT) hotpop (DOT) com> wrote: Dru <Dontemailme (AT) comcast (DOT) net> writes: Am I missing something simple? I can't figure this one out... You are missing two simple things (and the standard completely). script language="JavaScript" type="text/javascript" (The language attribute is not needed, but is not incorrect in HTML 4 Transitional). function showDesc(desc) { showDescription.innerText = desc; You are using a (probably global) variable called "showDescription". If you haven't declared it, it won't be there in FireFox (or many other browsers). I guess you want it to refer to an element with the name or id "showDescription". IE creates variables referring to named elements, but it's not part of any standard, and many other browsers don't. It's a FAQ entry: URL:http://jibbering.com/faq/#FAQ4_41 You also use the property "innerText", which is a proprietary IE feature. It won't work in most other browsers, including FireFox. You can either use the more widely implemented, but just as proprietary, innerHTML property, or you can use W3C DOM methods. URL:http://jibbering.com/faq/#FAQ4_15 /L |
![]() |
| Thread Tools | |
| Display Modes | |
| |