Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    1
    Thanks
    0
    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" />

    </head>
    <body>
    <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" />
    </div>

    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
    Posts
    974
    Thanks
    19
    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
    •