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 16:42
Regular
"Pouch Ape"
Posts: 14,499
Maybe it would be better using a "&subpage=yyy" in addition to the "?page=xxx"? I'm sure people would be prepared to wait that split second or the text to load, and it would be more browser-friendly. Also more search-engine friendly as it'll be a bit confusing being linked to a page and the content is hidden in a div.

Looks ok, if a bit like a powerpoint presentation.
Wed 03/08/05 at 15:54
Regular
"Peace Respect Punk"
Posts: 8,069
There is a slight 'glitch' in the javascript that means if you click an image link to take you to the PHP subpage, then move the mouse off the image before it loads, then mouseover another element, it displays two of the DIVs at the same time...

I only found this out because I was messing around testing it though, and I know why it does that, but to fix it I'd need seperate js code for every page that uses the mouse overs, and the code would be much longer and more messy... Essentially I don't think the situation will really occur for people using the page normally (ie. not going out of their way to test and try and catch out the js code...) so I'm not going to bother fixing that slight glitch... I think it's fine as is.
Wed 03/08/05 at 15:06
Regular
"l33t cs50r"
Posts: 2,956
Sibs wrote:
> Whey!
>
> After much messing around and trying many things that might work,
> I've finally got it to work!
>
> :D

Despite my previous comments, I do quite like it. Well done it getting it working.
Wed 03/08/05 at 14:34
Regular
"Peace Respect Punk"
Posts: 8,069
Whey!

After much messing around and trying many things that might work, I've finally got it to work!

:D
Wed 03/08/05 at 14:14
Regular
"Peace Respect Punk"
Posts: 8,069
Click on the pages and see.

I know that displaying content with JS is a bit dodgy, but I first built all these pages so on clicking the rollover links (they weren't rollovers at this point), the PHP takes you to index.php?page=(whatever)&sub=(subpage)

This means if you have js you can simply mouseover for the content, if not you can click the image for it and the PHP will display the correct content for that subpage...


Anyway, I have very little idea what's going on... I got rid of the div containing the rollover menu and centered the elements of it with padding... And now the scroll bar doesn't come up in FF! Which is good. However, now in IE the text in the rollovers isn't centered...

Confuzzling...
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?
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: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 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 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.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Just a quick note to say thanks for a very good service ... in fact excellent service..
I am very happy with your customer service and speed and quality of my broadband connection .. keep up the good work . and a good new year to all of you at freeola.
Matthew Bradley
I've been with Freeola for 14 years...
I've been with Freeola for 14 years now, and in that time you have proven time and time again to be a top-ranking internet service provider and unbeatable hosting service. Thank you.
Anthony

View More Reviews

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

Go to Support Centre

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.