HighDots Forums  

Re: Is this JS Script cross-browser

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Re: Is this JS Script cross-browser in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Randy Webb
 
Posts: n/a

Default Re: Is this JS Script cross-browser - 03-25-2006 , 12:25 AM






rfr said the following on 3/25/2006 12:29 AM:
Quote:
I have found a show-hide script that is nice and short and seems easy to
use.

But, I dont know if it is cross-browser.
It isn't.

Quote:
I have just current version of MSIE, Netscape and Opera and it works
in them. I do want to know if this works with other, especially the
slightly older browsers.
What qualifies as "slightly older"? 1 year? 5 years? 10 years?

Quote:
script type="text/javascript"
!--
function ShowHide(id, visibility) {
obj = document.getElementsByTagName("div");
obj[id].style.visibility = visibility;
}
//--
/script
That looks like a dumb way to do this:

function showHide(id,displayMode){
document.getElementById(id).style.visibility = displayMode;
}

But, do you know the difference between .style.visibility = "hidden" and
..style.display = "none";?

<snip>

Quote:
a href="javascript:ShowHide('sub1Div','visible')">sh ow.sub1</a> |
<URL: http://jibbering.com/faq/#FAQ4_24 >

Quote:
Does anyone know what browsers this won't work in?
It won't work in browsers that do not support the features you are
trying to use.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #2  
Old   
rfr
 
Posts: n/a

Default Re: Is this JS Script cross-browser - 03-25-2006 , 09:13 PM






I am a cut-n-paste js script user seeking a show/hide script that is simple
to impliment. This one loooks simple to use. Good.

However, I know just enough to suspect that this works only with the
browsers that use the new coding. If that is true, then this would fail on
any browsers except those that use the new coding. Thus, I suspected that on
browsers over 2 years old this scipt might fail. Bad.

Can you point me to a show/hide js script that is BOTH simple to implement
AND will handle recent browsers, say , . . since the major shift . . what
was it . . since about NS 4?

"Randy Webb" <HikksNotAtHome (AT) aol (DOT) com> wrote

Quote:
rfr said the following on 3/25/2006 12:29 AM:
I have found a show-hide script that is nice and short and seems easy to
use.

But, I dont know if it is cross-browser.

It isn't.

I have just current version of MSIE, Netscape and Opera and it works
in them. I do want to know if this works with other, especially the
slightly older browsers.

What qualifies as "slightly older"? 1 year? 5 years? 10 years?

script type="text/javascript"
!--
function ShowHide(id, visibility) {
obj = document.getElementsByTagName("div");
obj[id].style.visibility = visibility;
}
//--
/script

That looks like a dumb way to do this:

function showHide(id,displayMode){
document.getElementById(id).style.visibility = displayMode;
}

But, do you know the difference between .style.visibility = "hidden" and
.style.display = "none";?

snip

a href="javascript:ShowHide('sub1Div','visible')">sh ow.sub1</a> |

URL: http://jibbering.com/faq/#FAQ4_24

Does anyone know what browsers this won't work in?

It won't work in browsers that do not support the features you are trying
to use.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/



Reply With Quote
  #3  
Old   
Randy Webb
 
Posts: n/a

Default Re: Is this JS Script cross-browser - 03-26-2006 , 02:01 AM



rfr said the following on 3/25/2006 10:13 PM:
Quote:
I am a cut-n-paste js script user seeking a show/hide script that is simple
to impliment. This one loooks simple to use. Good.

However, I know just enough to suspect that this works only with the
browsers that use the new coding. If that is true, then this would fail on
any browsers except those that use the new coding. Thus, I suspected that on
browsers over 2 years old this scipt might fail. Bad.
Closer to browsers that are 5 years old or so. IE6 is ancient and it
supports what your script does.

Quote:
Can you point me to a show/hide js script that is BOTH simple to implement
AND will handle recent browsers, say , . . since the major shift . . what
was it . . since about NS 4?
The function I gave in my last reply:

function showHide(id,displayMode){
document.getElementById(id).style.visibility = displayMode;
}

Will work in IE5.0+, NS6+, Opera7 for sure (not sure about O6) and most
"current" MAC browsers.

But, the use of href="javascript: is a bigger problem than the script is.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #4  
Old   
rfr
 
Posts: n/a

Default Re: Is this JS Script cross-browser - 03-26-2006 , 02:44 PM



What is the problem that you speak of with the use of href="javascript:?

Is there a preferred method to evoke this function that works more reliably
or more cross-browser than this?

"Randy Webb" <HikksNotAtHome (AT) aol (DOT) com> wrote

Quote:
rfr said the following on 3/25/2006 10:13 PM:
I am a cut-n-paste js script user seeking a show/hide script that is
simple to impliment. This one loooks simple to use. Good.

However, I know just enough to suspect that this works only with the
browsers that use the new coding. If that is true, then this would fail
on any browsers except those that use the new coding. Thus, I suspected
that on browsers over 2 years old this scipt might fail. Bad.

Closer to browsers that are 5 years old or so. IE6 is ancient and it
supports what your script does.

Can you point me to a show/hide js script that is BOTH simple to
implement AND will handle recent browsers, say , . . since the major
shift . . what was it . . since about NS 4?

The function I gave in my last reply:

function showHide(id,displayMode){
document.getElementById(id).style.visibility = displayMode;
}

Will work in IE5.0+, NS6+, Opera7 for sure (not sure about O6) and most
"current" MAC browsers.

But, the use of href="javascript: is a bigger problem than the script is.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/



Reply With Quote
  #5  
Old   
Randy Webb
 
Posts: n/a

Default Re: Is this JS Script cross-browser - 03-26-2006 , 10:13 PM



rfr said the following on 3/26/2006 3:44 PM:
Quote:
What is the problem that you speak of with the use of href="javascript:?
The most common is with IE and animated gifs. If you have an animated
gif on a page in IE and click a href="javascript: link then the
animation will stop.

Quote:
Is there a preferred method to evoke this function that works more reliably
or more cross-browser than this?
The URL I gave explains it, but here goes:

<a href="noScript.html" onclick="someFunction();return false">Some
Function</a>

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.