homepage Welcome to WebmasterWorld Guest from 54.227.215.140
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Javascript errors on clients machine?
its fine here on pc/mac ie nn..
BenG

10+ Year Member



 
Msg#: 187 posted 9:34 am on Sep 9, 2002 (gmt 0)

Hi could anyone do a quick site check for me:
**REMOVED BY BENG** SORRY
when u enter the page, client says that rollovers do not work? I really tried for cross browser compatability here as well.. any pointers appreciated.

[edited by: BenG at 10:01 am (utc) on Sep. 9, 2002]

 

SmallTime

10+ Year Member



 
Msg#: 187 posted 9:54 am on Sep 9, 2002 (gmt 0)

Hi BenG, welcome to webmasterworld. We don't do site check, or post urls here, causes too much trouble. (see TOS, below)A moderator will edit that URL (unless you do first :))

Perhaps they had javascript turned off?

You can also do css rollovers, less code, work in all newer browsers.

If you have a particular issue, sometimes posting a detailed question will get helpful responses. Also the site search is useful.

BenG

10+ Year Member



 
Msg#: 187 posted 10:04 am on Sep 9, 2002 (gmt 0)

thanks for the post, sorry wasnt sure about the site check. Client has javascript turned on here is example of my browser testing
//set variables for browser usage here and use as global
//basic ns4 test
isNS4=(document.layers? true : false);
// test for IE4
isIE4 = (document.all && !document.getElementById)? true : false;
// both IE5 and NS6 are DOM-compliant which is WC3 standard and future browser compliant
isDOM = (document.getElementById)? true : false;
//make purpose button hihglighted when page loads
if(isNS4){
document.images['purpose'].src = 'images/buttons/purpose_f2.gif';
}
if(isIE4){
document.images['purpose'].src = 'images/buttons/purpose_f2.gif';
}
if(isDOM){
document.getElementById("purpose").setAttribute('src', "images/buttons/purpose_f2.gif");
}
I'm kind of stuck on this one - and i normally use basic css rolovers - often client wants sepcific font - futura in this case :(
rewboss

10+ Year Member



 
Msg#: 187 posted 10:46 am on Sep 9, 2002 (gmt 0)

So, what actually happens, and in which browser?

BenG

10+ Year Member



 
Msg#: 187 posted 12:05 pm on Sep 9, 2002 (gmt 0)

as usual they haven't specified which browser - awaiting response for that but client experiences "disapperaing buttons", theres too much code to post it all here, but the above code is pretty much whats used throughout for image swapping.

starway

10+ Year Member



 
Msg#: 187 posted 3:12 pm on Sep 9, 2002 (gmt 0)

If the posted code is for image rollover effect only, then it has a lot of useless rubbish.
All you need is this:

if (document.images)
document.images['purpose'].src = 'images/buttons/purpose_f2.gif'

Of course, it's probably a part of the complete script that serves for some other things. But if it's just for rollovers, remove everything except what I wrote here. You just don't need all the rest.

mivox

WebmasterWorld Senior Member mivox us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 187 posted 6:07 pm on Sep 9, 2002 (gmt 0)

Are you preloading the rollover images in the <head> of the page code? Disappearing buttons are often caused (in my experience) when the rollover images are not pre-loaded, so when the user rolls over the button, it seems to disappear while the mouseover image loads. If all the images are pre-loaded though, the change should be instantaneous.

BenG

10+ Year Member



 
Msg#: 187 posted 8:49 am on Sep 10, 2002 (gmt 0)

another forum user posted the following
Saw your site and your client is right . your buttons do send you where you want to go , but they dissapear the minute you click on them and you have to browse over to make them reappear again !

Browsers with this behaviour so far include
Windows 98, IE 5.00.2919.6307. Windows 2k
Pro, IE 5.00.2919.6307. WinXP pro Explorer 6.

Here is the swap button code
function changeMenu(next){
var layers=chosen+"Layer";
if (chosen!="present") {
if (isNS4) {
document.layers[chosen+"Layer"].visibility = "hide"
}
if(isIE4){
document.all[chosen+"Layer"].style.visibility = "hidden";
}
if(isDOM){
document.getElementById(chosen+"Layer").style.visibility = 'hidden';
}
}
//need to hide scroller if chosen already
if (chosen=="present"){
hidePresent()
}
if (next!="present") {
if (isNS4) {
document.layers[next+"Layer"].visibility = "show"
}
if(isIE4){
document.all[next+"Layer"].style.visibility = "visible";
}
if(isDOM){
document.getElementById(next+"Layer").style.visibility = 'visible';
}
}
//show scroller if chosen
if (next=="present"){
showPresent();
}
//swap existing highlighted button back to original state
returnImage='images/buttons/'+chosen+'.gif';
if (isNS4) {
document.images[chosen].src = returnImage;
}
if(isIE4){
document.images[chosen].src = returnImage;
}
if(isDOM){
document.getElementById(chosen).setAttribute('src', returnImage);
}
//set new button to highlighted state
chosen=next;
replaceImage='images/buttons/'+chosen+'_f2.gif'
flip(chosen, replaceImage);
}
and here is the code that sets it
<a href="javascript:void(0)" onClick="javascript:changeMenu('purpose')" onMouseOut="restoreImage('purpose')" onMouseOver="swapImage('purpose'); return false;">
I did have a on click="this.blur()" which i have removed to see wether that would help.
Starway - thanks for the input however your code will not swap an image in netscape 6.1 and greater.

rewboss

10+ Year Member



 
Msg#: 187 posted 9:36 am on Sep 10, 2002 (gmt 0)

thanks for the input however your code will not swap an image in netscape 6.1 and greater

Try writing, simply: document.images['purpose'].src='images/buttons/purpose_f2.gif' -- this will cause an error in Netscape 2, in case that's important for you...

But, wow, what a lot of code for such a simple task. Somewhere on this board I posted my own ultra-compact JavaScript rollover code... Now, where is it...?

BenG

10+ Year Member



 
Msg#: 187 posted 9:54 am on Sep 10, 2002 (gmt 0)

but it does more than rollover code, if they are in a scrolling section we need to hide 3 layers and swap an image, else we swap images and layers. I also had to make sure that the rollovers wouldnt work when they were clicked - so there is a lot more code than this.

BenG

10+ Year Member



 
Msg#: 187 posted 12:49 pm on Sep 10, 2002 (gmt 0)

finally found a browser this was happening on! The only way it seemed to work was by removing the javascipt:void(0) and replacing with a #. Thanks for the input everyone. I thought that my script was crossbrowser and therefore good - maybe long? it works, mac/pc ie 4 upwards, netscape4.7 upwards, mozilla 1.0, opera 5.0. And supposedly future browser compliant hence the (isDOM)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved