[Javascript] targeting div id with dynamic text

Jay Lepore admin at myinternethandyman.com
Fri Aug 10 05:08:01 CDT 2001


I want to dedicated one line of text as a 'help line' in a web site
shopping cart for merchants adding stuff.

So I put the default text in a div like this:

<div id = "helparea" style="position:relative; visibility: visible">HELP
TEXT WILL DISPLAY HERE </div>

Then I inserted my JS code:

<script>
function changetext(whichcontent){
if (document.all||document.getElementById){
var cross_el=window.document.all.helparea;
alert("in ie here and cross_ell="+cross_el);
cross_el.innerHTML='NEW TEXT HERE '+whichcontent;
}
else if (document.layers){
var divname=window.document.layers.page1.document.helparea;
document.write.divname('NEW TEXT HERE '+whichcontent);
}
}
</script>


Then my onClick event:

<a href="wherever.html" onmouseover="changetext('ASFD')>HOVER HERE FOR
HELP</A>

Of course it works find in IE but I can't figure out the code to display
in Netscape

Please note that the div called 'helparea' is nested inside of a div
called 'page1' if that matters.

Thanks a bunch

Jay




More information about the Javascript mailing list