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!
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!
Tue 02/08/05 at 18:46
Regular
"NULL"
Posts: 1,384
Does it work if you don't use PHP to print the



> 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...
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 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 11:31
Regular
"NULL"
Posts: 1,384
At a guess, I would say firefox is stacking the divs vertically, and although hidden, they are taller than the page, so it puts a scrollbar down the side?

I'm only guessing though - you'd be better asking someone like m_m or Tyla.
Wed 03/08/05 at 12:14
Regular
"Peace Respect Punk"
Posts: 8,069
Thing is, on this page there are 4 divs...

The other two pages, one has 3 divs and another has... 7 or 8 I think... And this problem doesn't occur with FF on those pages... And the divs are just as tall or taller...

I can't see why this is happening... The scroll bar only appears on mousing over one of the elements that changes the page content...

Is there any way of forcing FF to have a crollbar even on a page that doesn't need it? If so I could just use that, and on mousing over the centered content wouldn't move...
Wed 03/08/05 at 13:09
Regular
"NULL"
Posts: 1,384
I seem to recall you can use the following CSS to force a scrollbar:

body {
height: 101%;
}
Wed 03/08/05 at 13:22
Regular
"Peace Respect Punk"
Posts: 8,069
That does force a scroll bar, thanks!

However... For some reason this seems to screw up the javascript even more... The divs just seem to appear at random places down the page with the body's height attribute set...

Very confusing...
Wed 03/08/05 at 13:26
Regular
"l33t cs50r"
Posts: 2,956
Nimco wrote:
> you'd be better asking someone like m_m or
> Tyla.

Personlly, I have no comment. There's serious issues using this concept with things like accessibility & usability. Whay happens if you disable JS?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Unrivalled services
Freeola has to be one of, if not the best, ISP around as the services they offer seem unrivalled.
Everybody thinks I am an IT genius...
Nothing but admiration. I have been complimented on the church site that I manage through you and everybody thinks I am an IT genius. Your support is unquestionably outstanding.
Brian

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.