Web Analytics Made Easy -
StatCounter HELP: external .js file - some trick things are happenning - CodingForum

Announcement

Collapse
No announcement yet.

HELP: external .js file - some trick things are happenning

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HELP: external .js file - some trick things are happenning

    hello,

    i know it is possible to create some javascript file with scripts available for all my pages - some .js external file. but how can i do that? and how can i call my script from the external file so i can use an onLoad event?
    i've used the "gotoURL" behaviour from DW. it gives me a script and the onLoad event.

    my "go to URL" script:
    Code:
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_goToURL() { //v3.0
      var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
      for (i=0; i<(args.length-1); i+=2) eval(args+".location='"+args[i+1]+"'");
    }
    //-->
    </script>
    onLoad event:
    Code:
    <body onLoad="MM_goToURL('parent.frames[\'janelab\']','02-homem1.htm');return document.MM_returnValue"></body>
    i've already created a .js file and i know the script to call the file, but how to make the onLoad functioning?

    call a .js file:
    Code:
    <script language="JavaScript" src="gotoURL.js" type="text/javascript" ></script>
    and the .js file contains the up script without "<script></script>" parts but it doesn't function at all!!!!

    you may find my project here:


    thanks for all your help.
    abel.
    --- head_0n is just a nick ---

  • #2
    please please please heeeelp

    ok Dave, so why doesn't my .js file function?!

    my gotourl.js file got this script:
    function MM_goToURL() { //v3.0
    var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
    for (i=0; i<(args.length-1); i+=2)
    eval(args+".location='"+args[i+1]+"'");
    }


    and it's called by:
    <script language="JavaScript" type="text/JavaScript" SRC="gotourl.js">
    </script>


    and loaded at the onLoad event, located at <body>.
    do you think i should locate it in some other place?
    <body onLoad="MM_goToURL('parent.frames['janelab']','02-homem1.htm');return document.MM_returnValue"></body>

    i'm sorry if i'm repeating myself, but i'm desperate here
    please give me some help, there's something i'm not managing quite well.
    i've posted the url where you can see the script functioning by being write in the page NOT using an external .js file.
    please check what i need to do here

    i'm also attaching my .js file so you can take a look.

    thanks once again.
    abel.
    abel.
    --- head_0n is just a nick ---

    Comment


    • #3
      even with that syntax corrected
      what's missing there?!...
      abel.
      --- head_0n is just a nick ---

      Comment


      • #4
        OK NOW!!!!

        thanks Dave the script is functioning quite well!!!

        suggestion: send it to macromedia

        is it possible to explain the diferences bettween your remodeled script and the orignal? i would like to know them if you have time for it.

        i was also commiting a second error:
        i should place

        <script language="JavaScript" type="text/JavaScript" SRC="gotoURL.js"></script>

        on every page.
        my "02-homem1.htm" (the page that it's called by the onLoad event) wasn't filled with that script, so the .js didn't function outside my local disk (in the server).

        i want to thanks all those who helped me too.

        YEAHP, IT'S OK NOW!!
        abel.
        abel.
        --- head_0n is just a nick ---

        Comment

        Working...
        X