Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Javascript: where in the <head></head to put it
Old 08-11-2004, 04:26 AM Javascript: where in the <head></head to put it
Skilled Talker

Posts: 79
Trades: 0
Hello.

I'm setting up preloading images and I have to put the script in the <head> of my page.

Does it matter where in the <head> I put it? It is currently before the <title> bit and before everything else. The reason being the way I have set up my php includes.

Also, there is another script after the <title> bit. Is this ok?

This is what <head> looks like:

<html><head>

<script></script>

<!--includes this php -->

<title></title>
<script></script>

</head>

Is that OK having two scripts spread out around the place?

Hamish
hamish is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-11-2004, 06:46 AM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
thats fine, no errors will occur, but I recommend (if possible) you put the title first, or people may not realize your page is loading.
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-11-2004, 11:29 AM
Skilled Talker

Posts: 79
Trades: 0
Thanks.

mmm, I will look into moving the title bit.

With regards preloading images, I have several different scripts. The one i'm using atm is:

<!-- Start Preload Script -->

<SCRIPT LANGUAGE="java.script">

<!-- This script and many more are available free online at -->
<!-- The java.script Source!! [ http://java.script.internet.com ] -->

image1 = new Image();
image1.src = "http://www.primoweb.biz/images/cornerTL.gif";

image2 = new Image();
image2.src = "http://www.primoweb.biz/images/cornerTR.gif";

image3 = new Image();
image3.src = "http://www.primoweb.biz/images/cornerBL.gif";

image4 = new Image();
image4.src = "http://www.primoweb.biz/images/cornerBR.gif";
// End -->

</script>

<!-- End Preload Script -->

It seems to work well with mozilla etc. but I'm not sure if it is working in IE.

Do you know of a better script?

Thanks
Hamish
hamish is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 11:56 AM
Unknown.

Posts: 1,693
Trades: 0
One you could use..

HTML Code:
<script LANGUAGE="JavaScript">
var myimages=new Array()
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}

//Enter path of images to be preloaded inside parenthesis. Extend list as desired.

preloadimages("http://mydomain.com/firstimage.gif","http://mydomain.com/secondimage.gif","http://mydomain.com/thirdimage.gif")

</script>
Also BTW there is no need for the dot between 'javascript'..

Quote:
<SCRIPT LANGUAGE="java.script">
Quote:
<SCRIPT LANGUAGE="javascript">
Hope this helps

-James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 12:16 PM
Skilled Talker

Posts: 79
Trades: 0
that helps loads!

I've never used arrays before. I guess I can just copy and paste taht as the code. I don't have to make any sort of array do I (or other file)? I can just copy and paste taht into the webpage and change the paths etc.

Thanks
Hamish
hamish is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 12:41 PM
Unknown.

Posts: 1,693
Trades: 0
yea.. all you need to change is the location of the images to load

-James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 12:43 PM
Skilled Talker

Posts: 79
Trades: 0
Brilliant! this forum rocks.

Thanks for all your help.

Hamish
hamish is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 01:28 PM
Skilled Talker

Posts: 79
Trades: 0
oo,
one last question.

do i have to put in the full path (ie "http://mydomain.com/firstimage.gif") in the preloadimages() arguement, or can I just put "firstimage.gif","second.gif"?

hamish
hamish is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 01:47 PM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
relative will be fine (firstimage.gif)
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Reply     « Reply to Javascript: where in the <head></head to put it
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37679 seconds with 12 queries