<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE>@page Section1 {size: 595.3pt 841.9pt; margin: 70.85pt 3.0cm 70.85pt 3.0cm; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EstiloCorreo17 {
        COLOR: windowtext; FONT-FAMILY: Arial
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=ES vLink=purple link=blue>
<DIV><SPAN class=007592609-25032003><FONT face=Arial color=#0000ff size=2>the
2nd way is how you would normally be calling your javascripts, but these
onclicks dont work if you are within a form in IE5.0, so that's when you
would use the 1st method. </FONT></SPAN></DIV>
<DIV><SPAN class=007592609-25032003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=007592609-25032003><FONT face=Arial color=#0000ff size=2>its on
this list that I learnt that so I'm pleased you asked!</FONT></SPAN></DIV>
<DIV><SPAN class=007592609-25032003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=007592609-25032003><FONT face=Arial color=#0000ff
size=2>ant</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Jaime Iniesta
[mailto:jaime@alazan.com]<BR><B>Sent:</B> 25 March 2003 09:26<BR><B>To:</B>
javascript@LaTech.edu<BR><B>Subject:</B> [Javascript] Link to Javascript
functions - what is best?<BR><BR></FONT></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hello, I’ve got a
question…</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">There are 2 ways to create a link
to a JavaScript function. Let’s say I’ve got a function like
this:</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><B><FONT face=Arial
size=2><SPAN lang=EN-GB
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">Function
doSomething()</SPAN></FONT></B></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><B><FONT face=Arial
size=2><SPAN lang=EN-GB
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">{</SPAN></FONT></B></P>
<P class=MsoNormal><B><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">
…</SPAN></FONT></B></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><B><FONT face=Arial
size=2><SPAN lang=EN-GB
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">}</SPAN></FONT></B></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">And I want to link to it later on
the HTML, so when the user clicks on the link, the function is
executed.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">The first way to do this is
this:</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
</SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><B><FONT face=Arial
size=2><SPAN lang=EN-GB
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"><a
href=”javascript:doSomething()”>Link 1</a></SPAN></FONT></B></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">It works, but I’ve detected that
if the page is still loading, when I click on the link, the page stops
loading, and the animated GIFs also stop its animation…</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">So the second way, and I think is
the best one, is this:</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><B><FONT face=Arial
size=2><SPAN lang=EN-GB
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"><a href=”#”
onClick=”doSomething()”>Link 2</a></SPAN></FONT></B></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">That is, having a null link (a
link to #) and calling the function on the onClick event of the link. In this
way, the loading of the page is not stopped.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I think this is the correct way to
do this, but I’ve heard that on some browsers it doesn’t
work…</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">An example of this second way of
opening windows is on this photographs page:</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><B><FONT face=Arial
size=2><SPAN lang=EN-GB
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"><A
href="http://www.thismustbetheplace.net/talking-heads-pictures-band.asp">http://www.thismustbetheplace.net/talking-heads-pictures-band.asp</A></SPAN></FONT></B></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks,</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Jaime</SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>