Author |
Topic  |
Nikkol
Forum Moderator
    
USA
6907 Posts |
Posted - 14 January 2003 : 08:18:35
|
Alright .. for the first time (I know .. bad designer!) I'm testing my site in Navigator. So I download the latest Navigator, but Javascripts on my page don't seem to run. Any idea? |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
Kat
Advanced Member
    
United Kingdom
3065 Posts |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
|
Kat
Advanced Member
    
United Kingdom
3065 Posts |
Posted - 14 January 2003 : 08:31:25
|
Sorry Nikkol, couldn't resist..
As regards your script, certain things are not valid in Netscape, such as document.all for example. Have you used anything that Javascript cannot handle? I know it is a very generic question.
Also, are you trying to do any collapsing / showing? |
KatsKorner
Installation Help | Snitz Mods | Forum Hosting
|
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 14 January 2003 : 08:51:04
|
Looks like you didn't change one of the default variables in the script. Is it a downloaded script or one you wrote yourself? Would it be possible to post it here for us to look over?
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
Posted - 14 January 2003 : 08:54:44
|
Yeah ... perhaps .. but I want to figure this one out for myself if I can ... not too good at javascript and I can stand to learn. This is what I've figured out so far. I need to detect the browser first. What's the best way to do that. The script is executed when an element is clicked. So, it grabs the name of the element and will expand a previously hidden element as well as change the source of an image. My main problem I believe is the difference between IE and Netscape javascript. Any one got any good sources where I can learn? |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
 |
|
Kat
Advanced Member
    
United Kingdom
3065 Posts |
Posted - 14 January 2003 : 09:01:44
|
You could try looking at irt.org. There is a JavaScript section on there that is pretty good. Ignore the popups - they are a pain but the resource is good.
|
KatsKorner
Installation Help | Snitz Mods | Forum Hosting
|
 |
|
Bookie
Average Member
  
USA
856 Posts |
Posted - 14 January 2003 : 09:43:24
|
I had some problems with this sort of thing in Netscape. Under the tools menu (I think) there is a javascript console that will tell you any errors you are receiving on your page.
The specific problem I ran into is with form elements but the problem might translate to other objects as well. In javascript I would reference a form element like formname.something.somethingelse. Well, Netscape couldn't find formname so I had to include document in front of it like document.formname.etc. Maybe that will help. |
Participate in my nonsense |
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
Posted - 14 January 2003 : 09:49:09
|
what I've got is a table row that has an id. I want to be able to hide and show it when something else is clicked. i can get it to work in ie, but not netscape. how do you reference an element with an id in netscape? |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 14 January 2003 : 10:20:19
|
I have something similar on one of the sites I'm working on at the moment. It uses divs rather than table cells, but the principles should still be the same. First off you'll need to create a class in your stylesheet for the elements you wish to show/hide and set the variables to whatever you want the default to be. Then you'll need to do is grab the user's browser type. There's a great browser sniffer script over at BrotherCake's but it's probably a bit over the top for this situation. A quicker way of doing it would be something along the lines of:
var isExp;
var isMoz;
var isNav;
if(document.all){
isExp=1;
}
if(document.getElementById&&!document.all){
isMoz=1;
}
if(document.layers){
isNav=1;
} To make the element visible, use the code below, replacing "object_id" to suit your needs:
if(isExp){
document.all#91;"object_id"#93;.style.visibility = "visible";
}
if(isMoz){
document.getElementById("object_id").style.visibility = "visible";
}
if(isNav){
document.layers#91;"object_id"#93;.visibility="show";
} Similarly, to hide the element, you would use:
if(isExp){
document.all#91;"object_id"#93;.style.visibility = "hidden";
}
if(isMoz){
document.getElementById("object_id").style.visibility = "hidden";
}
if(isNav){
document.layers#91;"object_id"#93;.visibility="hide";
} Hope this goes some way towards solving your problem.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 14 January 2003 10:21:45 |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 14 January 2003 : 10:32:36
|
quote: Originally posted by Nikkol
okay, i got the hide and show working, except in Netscape once it hides, it does not collapse the table row... any suggestions? 
D'oh! Was still typing my reply when you posted that!
Looks like you're showing/hiding the table cell which won't collapse the row, you'll need to give the id to the <tr> tag rather than the <td>.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
Posted - 14 January 2003 : 10:32:55
|
This is what I have. And here are the quirks. Works great in IE. The expand works in Netscape, except it messes with text alignment for some reason. The collapse part sorta works in Netscape ... it hides the text, but does not collapse the table row. I might have to switch to divs if I can't get the table thing working.
<script language="javascript">
function expandIt(element) {
if (IE4==1) {
whichEl = eval("document.all." + element + "menu");
whichIm = eval("document.all." + element + "img");
} else {
whichEl = document.getElementById(element+"menu");
whichIm = eval("document.images[element+'img']");
}
if (whichEl.style.display == "none") {
whichEl.style.display = "block";
whichIm.src = "images/collapse.gif";
}
else {
whichEl.style.display = "none";
whichIm.src = "images/expand.gif";
}
}
</script>
BTW ... the id is in the tr tag. |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
Edited by - Nikkol on 14 January 2003 10:33:58 |
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 14 January 2003 : 10:45:30
|
Very odd indeed! I can't see anything wrong with your javascript; if expand works then so should collpase... It's got me stumped... Is the javascript console showing any errors?
If you convert from a table to divs, there's nothing to say that you won't encounter the same problem.
BTW, Try using cursor:pointer for Netscape
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 14 January 2003 10:46:26 |
 |
|
Topic  |
|