View Full Version : How do I call this popup from a .js file??

09-05-2011, 11:08 PM
How do I call this popup from a .js file??

Here is my popup code
<script type="text/javascript" src="fad.js"></script>
<link rel="stylesheet" type="text/css" href="fad.css" />

<div id="fa">
<div class="fa_close"><a href="#" onclick="hFa()"><img src="close1.jpg" /></a></div>
<h1><i>THIS WEEK'S</i></h1>
<img src="special.jpg" alt="special" />

From html I would call it using: <script type="text/javascript">sFa();</script>

How do I activate this popup from a .js file

09-06-2011, 12:12 AM
<script type="text/javascript" src="fad.js"></script>
Everything in the file fad.js is included between the
opening and closing script tags, so it's just the same
as if it were actually typed there so, if you just
put sFa() in the file it will run but, as written it will
run before the page is loaded. This might not be
what you want.You probably want it in an onload
event handler ?