Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Thanked 0 Times in 0 Posts

    Question How do I call this popup from a .js file??

    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

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Thanked 212 Times in 210 Posts
    <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 ?


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts