dw preload function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MALdito

    dw preload function

    hi everybody

    let me say right from the start .. I´m not a coder ... "just" a designer!
    that said .. here is my question:

    I´m using dreamweaver´s built in preloader for a menu. it looks like this:

    function MM_preloadImage s() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0; i<a.length;
    i++)
    if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

    Then, in the body tag you have the preload:

    <body onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">

    But I don´t want the function calls to be in the file itself, BUT linked to
    an extenal js file.

    can you PLEASE tell me how to do it?? (using this confusing dw
    code -mm_preloadimage s that is-)


    --

    --------------------------------------
    Part of the "No Signature Movement"
    My site: http://www.webbasica.com
    And for all those spammers out there,
    knock yourself out:
    maldito@webbasi ca.com


  • Thomas 'PointedEars' Lahn

    #2
    Re: dw preload function

    MALdito wrote:
    [color=blue]
    > let me say right from the start .. I´m not a coder ... "just" a designer![/color]

    Well, *become* a coder.
    [color=blue]
    > I´m using dreamweaver´s built in preloader for a menu. it looks like this:
    >
    > function MM_preloadImage s() { //v3.0
    > [...]
    > }[/color]

    What a line-optimized trash. I know why I'm not using DW anymore.
    [color=blue]
    > Then, in the body tag[/color]

    You mean the start tag of the `body' element.
    [color=blue]
    > you have the preload:
    >
    > <body onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">
    >
    > But I don´t want the function calls to be in the file itself, BUT linked to
    > an extenal js file.[/color]

    Do it then and use

    <script src="foobar.js" type="text/javascript"></script>

    somewhere within the `head' element.
    [color=blue]
    > can you PLEASE tell me how to do it?? (using this confusing dw
    > code -mm_preloadimage s that is-)[/color]

    Preloading images is a Bad Thing because you let people download data they
    don't requested and most certainly won't need. Even if the caching does the
    trick (which isn't for sure since you can't change the cache settings on the
    client,) it slows your website down in the beginning, so most certainly
    neither you nor the user will have any benefit from it. Let it be.


    PointedEars

    Comment

    • steve stevo

      #3
      Re: dw preload function

      You will need to create a .js file with the function in it

      eg whatever.js

      Then attach the .js file to whichever pages / files you want to use it

      <script src="whatever.j s"></script>

      then all you need to do is call the function by using

      MM_preloadimage s('im/im1.jpg','im/im2.jpg')

      etc - the function will automatically detect how many images you are trying
      to preload,

      unfortunately there are too many people like Thomas Lahn, too eager to
      brag - to slow to assist.

      Hope this helps

      Simon Christie


      "MALdito" <maldito@webbas ica.com> wrote in message
      news:bn07jm$rvh 5i$1@ID-122517.news.uni-berlin.de...[color=blue]
      > hi everybody
      >
      > let me say right from the start .. I´m not a coder ... "just" a designer!
      > that said .. here is my question:
      >
      > I´m using dreamweaver´s built in preloader for a menu. it looks like this:
      >
      > function MM_preloadImage s() { //v3.0
      > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
      > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;[/color]
      i<a.length;[color=blue]
      > i++)
      > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;[/color]
      d.MM_p[j++].src=a[i];}}[color=blue]
      >
      > Then, in the body tag you have the preload:
      >
      > <body[/color]
      onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=blue]
      >
      > But I don´t want the function calls to be in the file itself, BUT linked[/color]
      to[color=blue]
      > an extenal js file.
      >
      > can you PLEASE tell me how to do it?? (using this confusing dw
      > code -mm_preloadimage s that is-)
      >
      >
      > --
      >
      > --------------------------------------
      > Part of the "No Signature Movement"
      > My site: http://www.webbasica.com
      > And for all those spammers out there,
      > knock yourself out:
      > maldito@webbasi ca.com
      >
      >[/color]


      Comment

      • MALdito

        #4
        Re: dw preload function

        Well thanks Simone!!

        I understood everything you said, and now I will try to explain exactly what
        I need...

        I need to "put" the calling functions in a linked file .. maybe even in the
        js itself. Actually, the first part (the js) can stay in the html. But the
        call functions has be external and then linked. Why? cause then, if i wanna
        add more sections to my site, the process will become really easier .. since
        all my layout is beeing done with ssi and linked stuff..

        So, what i need is (in lesser words) .. how to put the calling functions
        (MM_preloadimag es) in a remote file? and for that matter .. how to should
        the remote js be? just copy and paste the js i have in the html right now,
        and name it whatever.js ? using the same syntax??

        thanks a lot for all the help

        ps: to the pointedears guy .. thanks, your pointless typing is what made
        simone help me ..


        "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
        news:bn0ge6$6ek $1@newsg1.svr.p ol.co.uk...[color=blue]
        > You will need to create a .js file with the function in it
        >
        > eg whatever.js
        >
        > Then attach the .js file to whichever pages / files you want to use it
        >
        > <script src="whatever.j s"></script>
        >
        > then all you need to do is call the function by using
        >
        > MM_preloadimage s('im/im1.jpg','im/im2.jpg')
        >
        > etc - the function will automatically detect how many images you are[/color]
        trying[color=blue]
        > to preload,
        >
        > unfortunately there are too many people like Thomas Lahn, too eager to
        > brag - to slow to assist.
        >
        > Hope this helps
        >
        > Simon Christie
        >
        >
        > "MALdito" <maldito@webbas ica.com> wrote in message
        > news:bn07jm$rvh 5i$1@ID-122517.news.uni-berlin.de...[color=green]
        > > hi everybody
        > >
        > > let me say right from the start .. I´m not a coder ... "just" a[/color][/color]
        designer![color=blue][color=green]
        > > that said .. here is my question:
        > >
        > > I´m using dreamweaver´s built in preloader for a menu. it looks like[/color][/color]
        this:[color=blue][color=green]
        > >
        > > function MM_preloadImage s() { //v3.0
        > > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        > > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;[/color]
        > i<a.length;[color=green]
        > > i++)
        > > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;[/color]
        > d.MM_p[j++].src=a[i];}}[color=green]
        > >
        > > Then, in the body tag you have the preload:
        > >
        > > <body[/color]
        > onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=green]
        > >
        > > But I don´t want the function calls to be in the file itself, BUT linked[/color]
        > to[color=green]
        > > an extenal js file.
        > >
        > > can you PLEASE tell me how to do it?? (using this confusing dw
        > > code -mm_preloadimage s that is-)
        > >
        > >
        > > --
        > >
        > > --------------------------------------
        > > Part of the "No Signature Movement"
        > > My site: http://www.webbasica.com
        > > And for all those spammers out there,
        > > knock yourself out:
        > > maldito@webbasi ca.com
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • steve stevo

          #5
          Re: dw preload function

          I think I can see what you're on about - you want to preload the same images
          x amount of times ?

          Lets look at the external .js file contents :

          function MM_preloadImage s() { //v3.0
          var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
          var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0; i<a.length;
          i++)
          if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;
          d.MM_p[j++].src=a[i];}}


          At the moment you have an event to call the javascript :

          <body onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">

          the event is the onload event

          but a function does not need an event to run - if you just placed

          MM_preloadimage s('/images/image1.jpg','/images/image2.jpg')

          within the <script> tags, the function would also run just the same - it
          would also run the same if it were also in an external file

          eg

          <script src="MM_Preload _Function.js">< script> // has the preload function in
          it
          <script src="MM_Preload _Function_Call. js"><script> // has the function call
          in it

          remember that when functions aren't called by events, thye will run as page
          is loaded, therefore you will need to load the function b4 you can call it.


          HTH

          Simon Christie

          PS - its Simon not Simone




          "MALdito" <maldito@webbas ica.com> wrote in message
          news:bn0t8a$rkv mr$1@ID-122517.news.uni-berlin.de...[color=blue]
          > Well thanks Simone!!
          >
          > I understood everything you said, and now I will try to explain exactly[/color]
          what[color=blue]
          > I need...
          >
          > I need to "put" the calling functions in a linked file .. maybe even in[/color]
          the[color=blue]
          > js itself. Actually, the first part (the js) can stay in the html. But the
          > call functions has be external and then linked. Why? cause then, if i[/color]
          wanna[color=blue]
          > add more sections to my site, the process will become really easier ..[/color]
          since[color=blue]
          > all my layout is beeing done with ssi and linked stuff..
          >
          > So, what i need is (in lesser words) .. how to put the calling functions
          > (MM_preloadimag es) in a remote file? and for that matter .. how to should
          > the remote js be? just copy and paste the js i have in the html right now,
          > and name it whatever.js ? using the same syntax??
          >
          > thanks a lot for all the help
          >
          > ps: to the pointedears guy .. thanks, your pointless typing is what made
          > simone help me ..
          >
          >
          > "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
          > news:bn0ge6$6ek $1@newsg1.svr.p ol.co.uk...[color=green]
          > > You will need to create a .js file with the function in it
          > >
          > > eg whatever.js
          > >
          > > Then attach the .js file to whichever pages / files you want to use it
          > >
          > > <script src="whatever.j s"></script>
          > >
          > > then all you need to do is call the function by using
          > >
          > > MM_preloadimage s('im/im1.jpg','im/im2.jpg')
          > >
          > > etc - the function will automatically detect how many images you are[/color]
          > trying[color=green]
          > > to preload,
          > >
          > > unfortunately there are too many people like Thomas Lahn, too eager to
          > > brag - to slow to assist.
          > >
          > > Hope this helps
          > >
          > > Simon Christie
          > >
          > >
          > > "MALdito" <maldito@webbas ica.com> wrote in message
          > > news:bn07jm$rvh 5i$1@ID-122517.news.uni-berlin.de...[color=darkred]
          > > > hi everybody
          > > >
          > > > let me say right from the start .. I´m not a coder ... "just" a[/color][/color]
          > designer![color=green][color=darkred]
          > > > that said .. here is my question:
          > > >
          > > > I´m using dreamweaver´s built in preloader for a menu. it looks like[/color][/color]
          > this:[color=green][color=darkred]
          > > >
          > > > function MM_preloadImage s() { //v3.0
          > > > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
          > > > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;[/color]
          > > i<a.length;[color=darkred]
          > > > i++)
          > > > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;[/color]
          > > d.MM_p[j++].src=a[i];}}[color=darkred]
          > > >
          > > > Then, in the body tag you have the preload:
          > > >
          > > > <body[/color]
          > > onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=darkred]
          > > >
          > > > But I don´t want the function calls to be in the file itself, BUT[/color][/color][/color]
          linked[color=blue][color=green]
          > > to[color=darkred]
          > > > an extenal js file.
          > > >
          > > > can you PLEASE tell me how to do it?? (using this confusing dw
          > > > code -mm_preloadimage s that is-)
          > > >
          > > >
          > > > --
          > > >
          > > > --------------------------------------
          > > > Part of the "No Signature Movement"
          > > > My site: http://www.webbasica.com
          > > > And for all those spammers out there,
          > > > knock yourself out:
          > > > maldito@webbasi ca.com
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • MALdito

            #6
            Re: dw preload function

            Sorry about the name ..

            Simon, so it would be ok if i put the js into an external file PLUS the
            function-call? what would be the syntax?

            MM_preloadimage s('/images/image1.jpg','/images/image2.jpg')

            no ; or } at the end??

            thanks!



            "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
            news:bn128m$a25 $1@news7.svr.po l.co.uk...[color=blue]
            > I think I can see what you're on about - you want to preload the same[/color]
            images[color=blue]
            > x amount of times ?
            >
            > Lets look at the external .js file contents :
            >
            > function MM_preloadImage s() { //v3.0
            > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
            > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;[/color]
            i<a.length;[color=blue]
            > i++)
            > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;
            > d.MM_p[j++].src=a[i];}}
            >
            >
            > At the moment you have an event to call the javascript :
            >
            > <body[/color]
            onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=blue]
            >
            > the event is the onload event
            >
            > but a function does not need an event to run - if you just placed
            >
            > MM_preloadimage s('/images/image1.jpg','/images/image2.jpg')
            >
            > within the <script> tags, the function would also run just the same - it
            > would also run the same if it were also in an external file
            >
            > eg
            >
            > <script src="MM_Preload _Function.js">< script> // has the preload function[/color]
            in[color=blue]
            > it
            > <script src="MM_Preload _Function_Call. js"><script> // has the function[/color]
            call[color=blue]
            > in it
            >
            > remember that when functions aren't called by events, thye will run as[/color]
            page[color=blue]
            > is loaded, therefore you will need to load the function b4 you can call[/color]
            it.[color=blue]
            >
            >
            > HTH
            >
            > Simon Christie
            >
            > PS - its Simon not Simone
            >
            >
            >
            >
            > "MALdito" <maldito@webbas ica.com> wrote in message
            > news:bn0t8a$rkv mr$1@ID-122517.news.uni-berlin.de...[color=green]
            > > Well thanks Simone!!
            > >
            > > I understood everything you said, and now I will try to explain exactly[/color]
            > what[color=green]
            > > I need...
            > >
            > > I need to "put" the calling functions in a linked file .. maybe even in[/color]
            > the[color=green]
            > > js itself. Actually, the first part (the js) can stay in the html. But[/color][/color]
            the[color=blue][color=green]
            > > call functions has be external and then linked. Why? cause then, if i[/color]
            > wanna[color=green]
            > > add more sections to my site, the process will become really easier ..[/color]
            > since[color=green]
            > > all my layout is beeing done with ssi and linked stuff..
            > >
            > > So, what i need is (in lesser words) .. how to put the calling functions
            > > (MM_preloadimag es) in a remote file? and for that matter .. how to[/color][/color]
            should[color=blue][color=green]
            > > the remote js be? just copy and paste the js i have in the html right[/color][/color]
            now,[color=blue][color=green]
            > > and name it whatever.js ? using the same syntax??
            > >
            > > thanks a lot for all the help
            > >
            > > ps: to the pointedears guy .. thanks, your pointless typing is what made
            > > simone help me ..
            > >
            > >
            > > "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
            > > news:bn0ge6$6ek $1@newsg1.svr.p ol.co.uk...[color=darkred]
            > > > You will need to create a .js file with the function in it
            > > >
            > > > eg whatever.js
            > > >
            > > > Then attach the .js file to whichever pages / files you want to use it
            > > >
            > > > <script src="whatever.j s"></script>
            > > >
            > > > then all you need to do is call the function by using
            > > >
            > > > MM_preloadimage s('im/im1.jpg','im/im2.jpg')
            > > >
            > > > etc - the function will automatically detect how many images you are[/color]
            > > trying[color=darkred]
            > > > to preload,
            > > >
            > > > unfortunately there are too many people like Thomas Lahn, too eager to
            > > > brag - to slow to assist.
            > > >
            > > > Hope this helps
            > > >
            > > > Simon Christie
            > > >
            > > >
            > > > "MALdito" <maldito@webbas ica.com> wrote in message
            > > > news:bn07jm$rvh 5i$1@ID-122517.news.uni-berlin.de...
            > > > > hi everybody
            > > > >
            > > > > let me say right from the start .. I´m not a coder ... "just" a[/color]
            > > designer![color=darkred]
            > > > > that said .. here is my question:
            > > > >
            > > > > I´m using dreamweaver´s built in preloader for a menu. it looks like[/color]
            > > this:[color=darkred]
            > > > >
            > > > > function MM_preloadImage s() { //v3.0
            > > > > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
            > > > > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;
            > > > i<a.length;
            > > > > i++)
            > > > > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;
            > > > d.MM_p[j++].src=a[i];}}
            > > > >
            > > > > Then, in the body tag you have the preload:
            > > > >
            > > > > <body
            > > > onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">
            > > > >
            > > > > But I don´t want the function calls to be in the file itself, BUT[/color][/color]
            > linked[color=green][color=darkred]
            > > > to
            > > > > an extenal js file.
            > > > >
            > > > > can you PLEASE tell me how to do it?? (using this confusing dw
            > > > > code -mm_preloadimage s that is-)
            > > > >
            > > > >
            > > > > --
            > > > >
            > > > > --------------------------------------
            > > > > Part of the "No Signature Movement"
            > > > > My site: http://www.webbasica.com
            > > > > And for all those spammers out there,
            > > > > knock yourself out:
            > > > > maldito@webbasi ca.com
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • steve stevo

              #7
              Re: dw preload function

              The best way is to try and see

              the correct syntax would be

              MM_preloadimage s('/images/image1.jpg','/images/image2.jpg');

              the ; signifies end of statement
              the curly brackets are used to define segments of a function

              eg
              function test(){
              if(true){
              alert("yippee") ;
              }else{
              alert("boohoo") ;
              }
              }

              Hope this helps

              Simon Christie


              "MALdito" <maldito@webbas ica.com> wrote in message
              news:bn13h8$qr0 u6$1@ID-122517.news.uni-berlin.de...[color=blue]
              > Sorry about the name ..
              >
              > Simon, so it would be ok if i put the js into an external file PLUS the
              > function-call? what would be the syntax?
              >
              > MM_preloadimage s('/images/image1.jpg','/images/image2.jpg')
              >
              > no ; or } at the end??
              >
              > thanks!
              >
              >
              >
              > "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
              > news:bn128m$a25 $1@news7.svr.po l.co.uk...[color=green]
              > > I think I can see what you're on about - you want to preload the same[/color]
              > images[color=green]
              > > x amount of times ?
              > >
              > > Lets look at the external .js file contents :
              > >
              > > function MM_preloadImage s() { //v3.0
              > > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
              > > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;[/color]
              > i<a.length;[color=green]
              > > i++)
              > > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;
              > > d.MM_p[j++].src=a[i];}}
              > >
              > >
              > > At the moment you have an event to call the javascript :
              > >
              > > <body[/color]
              > onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=green]
              > >
              > > the event is the onload event
              > >
              > > but a function does not need an event to run - if you just placed
              > >
              > > MM_preloadimage s('/images/image1.jpg','/images/image2.jpg')
              > >
              > > within the <script> tags, the function would also run just the same - it
              > > would also run the same if it were also in an external file
              > >
              > > eg
              > >
              > > <script src="MM_Preload _Function.js">< script> // has the preload[/color][/color]
              function[color=blue]
              > in[color=green]
              > > it
              > > <script src="MM_Preload _Function_Call. js"><script> // has the function[/color]
              > call[color=green]
              > > in it
              > >
              > > remember that when functions aren't called by events, thye will run as[/color]
              > page[color=green]
              > > is loaded, therefore you will need to load the function b4 you can call[/color]
              > it.[color=green]
              > >
              > >
              > > HTH
              > >
              > > Simon Christie
              > >
              > > PS - its Simon not Simone
              > >
              > >
              > >
              > >
              > > "MALdito" <maldito@webbas ica.com> wrote in message
              > > news:bn0t8a$rkv mr$1@ID-122517.news.uni-berlin.de...[color=darkred]
              > > > Well thanks Simone!!
              > > >
              > > > I understood everything you said, and now I will try to explain[/color][/color][/color]
              exactly[color=blue][color=green]
              > > what[color=darkred]
              > > > I need...
              > > >
              > > > I need to "put" the calling functions in a linked file .. maybe even[/color][/color][/color]
              in[color=blue][color=green]
              > > the[color=darkred]
              > > > js itself. Actually, the first part (the js) can stay in the html. But[/color][/color]
              > the[color=green][color=darkred]
              > > > call functions has be external and then linked. Why? cause then, if i[/color]
              > > wanna[color=darkred]
              > > > add more sections to my site, the process will become really easier ..[/color]
              > > since[color=darkred]
              > > > all my layout is beeing done with ssi and linked stuff..
              > > >
              > > > So, what i need is (in lesser words) .. how to put the calling[/color][/color][/color]
              functions[color=blue][color=green][color=darkred]
              > > > (MM_preloadimag es) in a remote file? and for that matter .. how to[/color][/color]
              > should[color=green][color=darkred]
              > > > the remote js be? just copy and paste the js i have in the html right[/color][/color]
              > now,[color=green][color=darkred]
              > > > and name it whatever.js ? using the same syntax??
              > > >
              > > > thanks a lot for all the help
              > > >
              > > > ps: to the pointedears guy .. thanks, your pointless typing is what[/color][/color][/color]
              made[color=blue][color=green][color=darkred]
              > > > simone help me ..
              > > >
              > > >
              > > > "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
              > > > news:bn0ge6$6ek $1@newsg1.svr.p ol.co.uk...
              > > > > You will need to create a .js file with the function in it
              > > > >
              > > > > eg whatever.js
              > > > >
              > > > > Then attach the .js file to whichever pages / files you want to use[/color][/color][/color]
              it[color=blue][color=green][color=darkred]
              > > > >
              > > > > <script src="whatever.j s"></script>
              > > > >
              > > > > then all you need to do is call the function by using
              > > > >
              > > > > MM_preloadimage s('im/im1.jpg','im/im2.jpg')
              > > > >
              > > > > etc - the function will automatically detect how many images you are
              > > > trying
              > > > > to preload,
              > > > >
              > > > > unfortunately there are too many people like Thomas Lahn, too eager[/color][/color][/color]
              to[color=blue][color=green][color=darkred]
              > > > > brag - to slow to assist.
              > > > >
              > > > > Hope this helps
              > > > >
              > > > > Simon Christie
              > > > >
              > > > >
              > > > > "MALdito" <maldito@webbas ica.com> wrote in message
              > > > > news:bn07jm$rvh 5i$1@ID-122517.news.uni-berlin.de...
              > > > > > hi everybody
              > > > > >
              > > > > > let me say right from the start .. I´m not a coder ... "just" a
              > > > designer!
              > > > > > that said .. here is my question:
              > > > > >
              > > > > > I´m using dreamweaver´s built in preloader for a menu. it looks[/color][/color][/color]
              like[color=blue][color=green][color=darkred]
              > > > this:
              > > > > >
              > > > > > function MM_preloadImage s() { //v3.0
              > > > > > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
              > > > > > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;
              > > > > i<a.length;
              > > > > > i++)
              > > > > > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;
              > > > > d.MM_p[j++].src=a[i];}}
              > > > > >
              > > > > > Then, in the body tag you have the preload:
              > > > > >
              > > > > > <body
              > > > >[/color][/color][/color]
              onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=blue][color=green][color=darkred]
              > > > > >
              > > > > > But I don´t want the function calls to be in the file itself, BUT[/color]
              > > linked[color=darkred]
              > > > > to
              > > > > > an extenal js file.
              > > > > >
              > > > > > can you PLEASE tell me how to do it?? (using this confusing dw
              > > > > > code -mm_preloadimage s that is-)
              > > > > >
              > > > > >
              > > > > > --
              > > > > >
              > > > > > --------------------------------------
              > > > > > Part of the "No Signature Movement"
              > > > > > My site: http://www.webbasica.com
              > > > > > And for all those spammers out there,
              > > > > > knock yourself out:
              > > > > > maldito@webbasi ca.com
              > > > > >
              > > > > >
              > > > >
              > > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • MALdito

                #8
                Re: dw preload function

                well ... you did it!

                thanks a lot

                m.


                "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
                news:bn2vje$rup $1@newsg1.svr.p ol.co.uk...[color=blue]
                > The best way is to try and see
                >
                > the correct syntax would be
                >
                > MM_preloadimage s('/images/image1.jpg','/images/image2.jpg');
                >
                > the ; signifies end of statement
                > the curly brackets are used to define segments of a function
                >
                > eg
                > function test(){
                > if(true){
                > alert("yippee") ;
                > }else{
                > alert("boohoo") ;
                > }
                > }
                >
                > Hope this helps
                >
                > Simon Christie
                >
                >
                > "MALdito" <maldito@webbas ica.com> wrote in message
                > news:bn13h8$qr0 u6$1@ID-122517.news.uni-berlin.de...[color=green]
                > > Sorry about the name ..
                > >
                > > Simon, so it would be ok if i put the js into an external file PLUS the
                > > function-call? what would be the syntax?
                > >
                > > MM_preloadimage s('/images/image1.jpg','/images/image2.jpg')
                > >
                > > no ; or } at the end??
                > >
                > > thanks!
                > >
                > >
                > >
                > > "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
                > > news:bn128m$a25 $1@news7.svr.po l.co.uk...[color=darkred]
                > > > I think I can see what you're on about - you want to preload the same[/color]
                > > images[color=darkred]
                > > > x amount of times ?
                > > >
                > > > Lets look at the external .js file contents :
                > > >
                > > > function MM_preloadImage s() { //v3.0
                > > > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
                > > > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;[/color]
                > > i<a.length;[color=darkred]
                > > > i++)
                > > > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;
                > > > d.MM_p[j++].src=a[i];}}
                > > >
                > > >
                > > > At the moment you have an event to call the javascript :
                > > >
                > > > <body[/color]
                > > onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=darkred]
                > > >
                > > > the event is the onload event
                > > >
                > > > but a function does not need an event to run - if you just placed
                > > >
                > > > MM_preloadimage s('/images/image1.jpg','/images/image2.jpg')
                > > >
                > > > within the <script> tags, the function would also run just the same -[/color][/color][/color]
                it[color=blue][color=green][color=darkred]
                > > > would also run the same if it were also in an external file
                > > >
                > > > eg
                > > >
                > > > <script src="MM_Preload _Function.js">< script> // has the preload[/color][/color]
                > function[color=green]
                > > in[color=darkred]
                > > > it
                > > > <script src="MM_Preload _Function_Call. js"><script> // has the function[/color]
                > > call[color=darkred]
                > > > in it
                > > >
                > > > remember that when functions aren't called by events, thye will run as[/color]
                > > page[color=darkred]
                > > > is loaded, therefore you will need to load the function b4 you can[/color][/color][/color]
                call[color=blue][color=green]
                > > it.[color=darkred]
                > > >
                > > >
                > > > HTH
                > > >
                > > > Simon Christie
                > > >
                > > > PS - its Simon not Simone
                > > >
                > > >
                > > >
                > > >
                > > > "MALdito" <maldito@webbas ica.com> wrote in message
                > > > news:bn0t8a$rkv mr$1@ID-122517.news.uni-berlin.de...
                > > > > Well thanks Simone!!
                > > > >
                > > > > I understood everything you said, and now I will try to explain[/color][/color]
                > exactly[color=green][color=darkred]
                > > > what
                > > > > I need...
                > > > >
                > > > > I need to "put" the calling functions in a linked file .. maybe even[/color][/color]
                > in[color=green][color=darkred]
                > > > the
                > > > > js itself. Actually, the first part (the js) can stay in the html.[/color][/color][/color]
                But[color=blue][color=green]
                > > the[color=darkred]
                > > > > call functions has be external and then linked. Why? cause then, if[/color][/color][/color]
                i[color=blue][color=green][color=darkred]
                > > > wanna
                > > > > add more sections to my site, the process will become really easier[/color][/color][/color]
                ...[color=blue][color=green][color=darkred]
                > > > since
                > > > > all my layout is beeing done with ssi and linked stuff..
                > > > >
                > > > > So, what i need is (in lesser words) .. how to put the calling[/color][/color]
                > functions[color=green][color=darkred]
                > > > > (MM_preloadimag es) in a remote file? and for that matter .. how to[/color]
                > > should[color=darkred]
                > > > > the remote js be? just copy and paste the js i have in the html[/color][/color][/color]
                right[color=blue][color=green]
                > > now,[color=darkred]
                > > > > and name it whatever.js ? using the same syntax??
                > > > >
                > > > > thanks a lot for all the help
                > > > >
                > > > > ps: to the pointedears guy .. thanks, your pointless typing is what[/color][/color]
                > made[color=green][color=darkred]
                > > > > simone help me ..
                > > > >
                > > > >
                > > > > "steve stevo" <steve@stevoste ve.fsnet.co.uk> escribió en el mensaje
                > > > > news:bn0ge6$6ek $1@newsg1.svr.p ol.co.uk...
                > > > > > You will need to create a .js file with the function in it
                > > > > >
                > > > > > eg whatever.js
                > > > > >
                > > > > > Then attach the .js file to whichever pages / files you want to[/color][/color][/color]
                use[color=blue]
                > it[color=green][color=darkred]
                > > > > >
                > > > > > <script src="whatever.j s"></script>
                > > > > >
                > > > > > then all you need to do is call the function by using
                > > > > >
                > > > > > MM_preloadimage s('im/im1.jpg','im/im2.jpg')
                > > > > >
                > > > > > etc - the function will automatically detect how many images you[/color][/color][/color]
                are[color=blue][color=green][color=darkred]
                > > > > trying
                > > > > > to preload,
                > > > > >
                > > > > > unfortunately there are too many people like Thomas Lahn, too[/color][/color][/color]
                eager[color=blue]
                > to[color=green][color=darkred]
                > > > > > brag - to slow to assist.
                > > > > >
                > > > > > Hope this helps
                > > > > >
                > > > > > Simon Christie
                > > > > >
                > > > > >
                > > > > > "MALdito" <maldito@webbas ica.com> wrote in message
                > > > > > news:bn07jm$rvh 5i$1@ID-122517.news.uni-berlin.de...
                > > > > > > hi everybody
                > > > > > >
                > > > > > > let me say right from the start .. I´m not a coder ... "just" a
                > > > > designer!
                > > > > > > that said .. here is my question:
                > > > > > >
                > > > > > > I´m using dreamweaver´s built in preloader for a menu. it looks[/color][/color]
                > like[color=green][color=darkred]
                > > > > this:
                > > > > > >
                > > > > > > function MM_preloadImage s() { //v3.0
                > > > > > > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
                > > > > > > var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0;
                > > > > > i<a.length;
                > > > > > > i++)
                > > > > > > if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image;
                > > > > > d.MM_p[j++].src=a[i];}}
                > > > > > >
                > > > > > > Then, in the body tag you have the preload:
                > > > > > >
                > > > > > > <body
                > > > > >[/color][/color]
                > onload="MM_prel oadimages('/images/image1.jpg','/images/image2.jpg')">[color=green][color=darkred]
                > > > > > >
                > > > > > > But I don´t want the function calls to be in the file itself,[/color][/color][/color]
                BUT[color=blue][color=green][color=darkred]
                > > > linked
                > > > > > to
                > > > > > > an extenal js file.
                > > > > > >
                > > > > > > can you PLEASE tell me how to do it?? (using this confusing dw
                > > > > > > code -mm_preloadimage s that is-)
                > > > > > >
                > > > > > >
                > > > > > > --
                > > > > > >
                > > > > > > --------------------------------------
                > > > > > > Part of the "No Signature Movement"
                > > > > > > My site: http://www.webbasica.com
                > > > > > > And for all those spammers out there,
                > > > > > > knock yourself out:
                > > > > > > maldito@webbasi ca.com
                > > > > > >
                > > > > > >
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                Working...