views:

40

answers:

1

Hi,

in all browsers I've trid other than ms internet explorer, I need to reload before my slider menu is visable.. could anyone shed some light!?

http://www.musical-transformations.com/gallery/index.html

Thanks,

A: 

Your <script></script> tag should be inside of the <head></head> tag and not else where.

My mistake, as per w3c standards, scripts included from other files go inside the head, where as scripts written on the page go inside the body. Either way, the point stands, and the script call both needs to be commented and needs to be moved into a tag that is not <html>.

Additionally you seem to have poorly balanced <center> tags. Finally don't forget to comment out your script with <!-- and --> wrapped around it

Your problems are probably there.

Mimisbrunnr
Actually `script` elements should be placed just before the closing tag of the `body` element.
anddoutoi
Actually, where a coder puts his scripts is entirely his choice. They will work pretty much anywhere as long as it's valid (or recoverable) HTML.
Andy E
Imo it´s not up to the coder. Putting scripts at the bottom is one of the rules of web page performance. http://developer.yahoo.com/performance/rules.html#js_bottom
anddoutoi
@anddoutoi: maybe you could argue that for externally referenced scripts but that rule doesn't apply to inline scripts. **and** it's still the decision of the coder (last time I checked programmers still had free will). That method is for including remote scripts (for instance jQuery, Google Maps) in case the remote server is slow at responding. If the current domain is slow at responding, the page would have performance problems regardless of whether the script is at the top or bottom.
Andy E
@Mimisbrunnr: Maybe you should read http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1. ANY script element can go *anywhere in the `<body>` or the `<head>`*. Also JavaScript is NOT required to be wrapped with comment delimiters.
Andy E
@Andy E: You are wrong. It applies to inline `script` as they also halt rendering of the page. Of course coders have free will but he would be facing a major whopping at code review.
anddoutoi
I've put the js in the head and use an onLoad trigger to make sure all images are loaded before the script is executed.I suspect previously the BySlideMenu was run before elements were created on the page, and thus images are not loaded... maybe they were okay once reloaded.Thanks to all for your help.. I think it works now!
The HCD
@anddoutoi: I don't think you quite understand the purpose of putting the script at the bottom. If the server hosting the script is having problems which cause the browser to download the file very slowly or eventually timeout it will prevent rendering the HTML that comes after the script. You can't have this problem with an inline script, the only thing that would cause rendering to halt for a noticeably long time is a loop, which would lock up the browser and prevent user interaction **even if it was right at the bottom of the html**. *continued*...
Andy E
*...* Anyone that criticised you for putting inline scripts before other HTML is the type of person that reads an article written by *Joe Nobody* and takes it as gospel. The type of person that thinks micro-optimizations will make the world of difference to the speed of their code.
Andy E
@Mimisbrunnr: Please accept my apologies for hijacking your answer thread - I just don't like being called wrong when really, I'm not :-)
Andy E