SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    quick help with javascript...

    I am putting a javascript on my site which is being loaded from another server --- and sometimes there are delays loading the javascript - and since the script is near the top of my page, it prevents the rest of my page from loading till it has connected to the other server. Is there a way to get around this? As in load the script at the bottom of the page but somehow put the placement of it where i want? I somehow load it in the same location but not let it take over the page loading proccess?

    Thanks

  2. #2
    SitePoint Member
    Join Date
    Dec 2002
    Location
    Clearwater, FL
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Putting it at the bottom should work.

    You could also try referencing the js without including it in the source code that anyone can see.

    Place the script tag somewhere before you need to call it, as follows:

    <SCRIPT LANGUAGE="JavaScript" src="log.js"></script>
    ...
    <input type="button" size="1" value="Login" onClick="Log()" ></td></tr>

    ie. have the js as a Function stored on the server.

    log.js:

    function Log(){
    var done=0;
    var username=document.login.username.value;
    username=username.toLowerCase();
    var password=document.login.password.value;
    ...

    This is from a login page where I don't want people to see the code I use to validate user/password.


    Bill Nye
    OCP

  3. #3
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hrmmm only thing about at the bottom, is its not just a general JS - its an actual part of the site (as in needs a specific location on my page to be placed) any other ideas?

    thanks


Bookmarks

Posting Permissions

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