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

Help tidy up javascript code

P: n/a
http://www.lajzar.co.uk/unit/

Is an index page. I have javascripts to open up submenus. But tehre are
quiter a lot of them, all simialr. Is there a way to unify all that
javascript into a single function?
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> http://www.lajzar.co.uk/unit/

Is an index page. I have javascripts to open up submenus. But tehre are
quiter a lot of them, all simialr. Is there a way to unify all that
javascript into a single function?
Sure...try this::

<HTML>
<HEAD>
<STYLE TYPE="text/css">
#anglo_ok { display: none; }
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Show(id1,id2) {document.getElementById(id1).style.display =
"block";document.getElementById(id2).style.dis play = "none"; return null;}
function Xejn() { }
-->
</SCRIPT>
</HEAD>
<BODY>

<TABLE BORDER WIDTH=100%>
<TR VALIGN=top><TD WIDTH=33%>

<DIV ID="anglo_ok">
<IMG SRC="../icon/hlp2.gif"><A HREF="javascript:Xejn()"
onclick="Show('anglo_no','anglo_ok')">Anglo-American Units</A><BR><P
CLASS="ind">
<IMG SRC="../icon/htm1.gif"><A HREF="system/imp_usa.html">US
Customary</A><BR>
<IMG SRC="../icon/htm1.gif"><A HREF="system/imp_brit.html">British
Imperial</A><BR>
<IMG SRC="../icon/htm1.gif"><A HREF="system/imp_intl.html">Modern
International</A><BR>
<IMG SRC="../icon/htm1.gif"><A HREF="system/imp_scot.html">Traditional
Scottish</A><BR>
<IMG SRC="../icon/htm1.gif"><A HREF="system/imp_eire.html">Traditional
Irish</A><BR></P>
</DIV>
<DIV ID="anglo_no">
<IMG SRC="../icon/hlp1.gif"><A HREF="javascript:Xejn()"
onclick="Show('anglo_ok','anglo_no')">Anglo-American Units</A><BR>
</DIV>
</table>

Please post next time the necesarry code...

Fabian
Visit my website often and for long periods!
Once and never again...
http://www.lajzar.co.uk

Jul 20 '05 #2

P: n/a

"Ang Talunin" <pl************@no-reply.com> wrote in message
news:10***************@halkan.kabelfoon.nl...

Please post next time the necesarry code...


Thats why I posted an url.
Fabian
Visit my website often and for long periods!


Once and never again...


I was going to thank you.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk
Jul 20 '05 #3

P: n/a

"Fabian" <la****@hotmail.com> schreef in bericht
news:bm************@ID-174912.news.uni-berlin.de...

"Ang Talunin" <pl************@no-reply.com> wrote in message
news:10***************@halkan.kabelfoon.nl...

Please post next time the necesarry code...


Thats why I posted an url.


But if you posted an url, people first have to visit your page...get the
source,s trip it down to the problem and solve it. If you just post what you
want to be solved you will get a much faster reaction...
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.