Gossamer Forum
Home : General : Perl Programming :

JavaScript & DHTML

Quote Reply
JavaScript & DHTML
Hi

I've currently got the following code:

Code:
<script language="JavaScript">
<!--

var ns6=document.getElementById&&!document.all?1:0

var head="display:''"
var folder=''

function expandit(curobj){
folder=ns6?curobj.nextSibling.nextSibling.style:document.all[curobj.sourceIndex+1].style
if (folder.display=="none")
folder.display=""
else
folder.display="none"
}

//-->
</script>

And then in the body of the page:

Code:
<font style="cursor:hand" onClick="expandit(this)">Click to expand</font>

<span style="display:none">expanded text in here</span>

This works in the latest versions of IE. It does not workin Mozilla however. It doesn't actually look like decent code to me. Has anyone else got a suitable alternative? Wouldn't it be better for me to redo this using more DHTML?

A working version of this document can be found here:

http://beta.geo-drws.co.uk/html/en/places.html

Thanks

- wil

Last edited by:

Wil: Dec 17, 2001, 2:37 AM