dw preload function

M

MALdito

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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

Then, in the body tag you have the preload:

<body onload="MM_preloadimages('/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_preloadimages that is-)


--

--------------------------------------
Part of the "No Signature Movement"
My site: http://www.webbasica.com
And for all those spammers out there,
knock yourself out:
(e-mail address removed)
 
T

Thomas 'PointedEars' Lahn

MALdito said:
let me say right from the start .. I´m not a coder ... "just" a designer!

Well, *become* a coder.
I´m using dreamweaver´s built in preloader for a menu. it looks like this:

function MM_preloadImages() { //v3.0
[...]
}

What a line-optimized trash. I know why I'm not using DW anymore.
Then, in the body tag

You mean the start tag of the `body' element.
you have the preload:

<body onload="MM_preloadimages('/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.

Do it then and use

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

somewhere within the `head' element.
can you PLEASE tell me how to do it?? (using this confusing dw
code -mm_preloadimages that is-)

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
 
S

steve stevo

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.js"></script>

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

MM_preloadimages('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
 
M

MALdito

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_preloadimages) 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 said:
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.js"></script>

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

MM_preloadimages('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 said:
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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

Then, in the body tag you have the preload:

<body onload="MM_preloadimages('/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_preloadimages that is-)


--

--------------------------------------
Part of the "No Signature Movement"
My site: http://www.webbasica.com
And for all those spammers out there,
knock yourself out:
(e-mail address removed)

 
S

steve stevo

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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}


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

<body onload="MM_preloadimages('/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_preloadimages('/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 said:
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_preloadimages) 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 said:
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.js"></script>

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

MM_preloadimages('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 said:
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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

Then, in the body tag you have the preload:

<body onload="MM_preloadimages('/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_preloadimages that is-)


--

--------------------------------------
Part of the "No Signature Movement"
My site: http://www.webbasica.com
And for all those spammers out there,
knock yourself out:
(e-mail address removed)

 
M

MALdito

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_preloadimages('/images/image1.jpg','/images/image2.jpg')

no ; or } at the end??

thanks!



steve stevo said:
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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}


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

<body onload="MM_preloadimages('/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_preloadimages('/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 said:
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_preloadimages) 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 said:
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.js"></script>

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

MM_preloadimages('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


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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}

Then, in the body tag you have the preload:

<body
onload="MM_preloadimages('/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_preloadimages that is-)


--

--------------------------------------
Part of the "No Signature Movement"
My site: http://www.webbasica.com
And for all those spammers out there,
knock yourself out:
(e-mail address removed)


 
S

steve stevo

The best way is to try and see

the correct syntax would be

MM_preloadimages('/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 said:
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_preloadimages('/images/image1.jpg','/images/image2.jpg')

no ; or } at the end??

thanks!



steve stevo said:
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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}


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

<body onload="MM_preloadimages('/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_preloadimages('/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 said:
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_preloadimages) 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" <[email protected]> escribió en el mensaje
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.js"></script>

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

MM_preloadimages('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


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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}

Then, in the body tag you have the preload:

<body
onload="MM_preloadimages('/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_preloadimages that is-)


--

--------------------------------------
Part of the "No Signature Movement"
My site: http://www.webbasica.com
And for all those spammers out there,
knock yourself out:
(e-mail address removed)


 
M

MALdito

well ... you did it!

thanks a lot

m.


steve stevo said:
The best way is to try and see

the correct syntax would be

MM_preloadimages('/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 said:
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_preloadimages('/images/image1.jpg','/images/image2.jpg')

no ; or } at the end??

thanks!



steve stevo said:
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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}


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

<body onload="MM_preloadimages('/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_preloadimages('/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




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_preloadimages) 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" <[email protected]> escribió en el mensaje
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
eager
to
brag - to slow to assist.

Hope this helps

Simon Christie


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_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}

Then, in the body tag you have the preload:

<body
onload="MM_preloadimages('/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_preloadimages that is-)


--

--------------------------------------
Part of the "No Signature Movement"
My site: http://www.webbasica.com
And for all those spammers out there,
knock yourself out:
(e-mail address removed)


 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top