GetDotted Domains

Viewing Thread:
"External Javascript"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Tue 02/08/05 at 17:42
Regular
"Peace Respect Punk"
Posts: 8,069
Okay, after doing lots of stuff with PHP, I'm making a (very) brief foray into JavaScript...

I've made two simple functions to hide / unhide divs based on what area of a page is moused over. They work fine when I shove the functions themselves in the page head, however, because it's in use with PHP, I only want the JS there if the $page variable is one of three pages... So I check for one of those pages, and if it's one of them I include the external JS files with the following code:


echo "";
echo "";


And this doesn't work... The echoed stuff is showing up (ie. nothing wrong with the PHP), the JavaScript functions just don't work... As if they're not being called...? Is there something I should know about calling JS functions from external JS sheets...?

Chars for any help!
Wed 03/08/05 at 09:48
Regular
"Peace Respect Punk"
Posts: 8,069
Okay, so I have everything workign now after naming my javascript folder "js" instead...

Now, very slight problem...

The following pages are fine in IE, and the first two also in FireFox...

[URL]http://www.enablingtechnologies.co.uk/index.php?page=capabilities[/URL]
[URL]http://www.enablingtechnologies.co.uk/index.php?page=news[/URL]
[URL]http://www.enablingtechnologies.co.uk/index.php?page=applications[/URL]

Except in FF, the last page forces a side navigation bar on mousing over, pushing everything over a bit... which is kinda annoying... I have no idea why it does this for the applications page, but nothing like this happens for the capabilities / news page... Any ideas?

I thought it might be because I had the javascript disaply the rollover div before hiding the default div (and vice versa on mousing out), however, I changed this in the javascript, so it canna be that... And that wasn't having any effect on the other pages anyhoo...
Wed 03/08/05 at 08:46
Regular
"Peace Respect Punk"
Posts: 8,069
Wha...?

Tried moving the .js files into the folder where the index.php and other stuff is located and changing the path to the .js files, and it then worked fine...

Then changed the name of the javascript folder to "js" and then changed the path to the .js files again (eg. "js/mouseover.js") and again, worked fine... Is there some rule against putting your .js files in a folder named javascript, because this is the only thing I've changed...? :-S
Wed 03/08/05 at 08:31
Regular
"Peace Respect Punk"
Posts: 8,069
Nimco wrote:
> Does it work if you don't use PHP to print the
Nope... I now have, in the index file tags:




> You should really use the type attribute with > be causing issues with the doc type.
>
> Can you put the contents of the external JS file in here for us to
> see?

mouseover.js:




mouseout.js:




> Check you've not got script tags in the external file, check the
> obvious things like the file exists and the path is correct, etc,
> etc.

I think all the basics are correct... Is there something additional I should be doing to call a funciton when it's in an external file...? Eg. at the moment I have the following code... The onMouseOver and onMouseOut are the only js bits, all the rest is already working with PHP / CSS:

Market Research

'mr' is the id for the
I want to appear / disappear on mouse overing that element...
Tue 02/08/05 at 18:46
Regular
"NULL"
Posts: 1,384
Does it work if you don't use PHP to print the ";
echo "";


And this doesn't work... The echoed stuff is showing up (ie. nothing wrong with the PHP), the JavaScript functions just don't work... As if they're not being called...? Is there something I should know about calling JS functions from external JS sheets...?

Chars for any help!

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

I am delighted.
Brilliant! As usual the careful and intuitive production that Freeola puts into everything it sets out to do. I am delighted.
Brilliant service.
Love it, love it, love it!
Christopher

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.