![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||||
| |||||
|
|
Folks, I am cross posting this into both stylesheets and javascript groups because its valid to both. I have a page that works just beautifully in Firefox without any errors yet not in IE7. Since there is no error console screen in IE I don't know where its going wrong and my entire userbase is based unfortunately IE based. I have a the following table and javascript functions: table id="box1" width="90%" border="1" cellspacing="1" cellpadding="1" summary="summary" class="box1" |
|
tr><td>here</td></tr table br><a href="#" onClick="show();">Show</a br><a href="#" onClick="hide();">Hide</a script language="JavaScript" ^^^^^^^^^^^^^^^^^^^^^ |
|
function hide() { document.all.box1.style.visibility="collapse"; ^^^ ^^^^^^^^ |
|
This works perfectly again in Firefox but will HIDE the table but not re-display the table when show is called (same "Could not get the visibility property. Invalid argument." message in IE7. |
|
Can someoe tell me where I am going wrong? I am wondering if its my javascript code and my usage of DOM and would appreciate any direction you can offer.... |
#3
| |||
| |||
|
|
(a) I highly doubt that this script "works" in Firefox. the "all" collection is MS proprietary DOM thingy. The DOM1+ method of getting an element on the page via its ID is: document.getElementById("box1") |
#4
| |||
| |||
|
|
Jonathan N. Little wrote: (a) I highly doubt that this script "works" in Firefox. the "all" collection is MS proprietary DOM thingy. The DOM1+ method of getting an element on the page via its ID is: document.getElementById("box1") Firefox transparently puts access for document.all in so that any site designed by people who that that IE = the Internet wouldn't horribly break in Firefox (chances are, though, lots of other stuff will break). if (document.all) will not execute in FF, but document.all.box1 will at least work. |
#5
| |||
| |||
|
|
Joshua Cranmer wrote: Jonathan N. Little wrote: (a) I highly doubt that this script "works" in Firefox. the "all" collection is MS proprietary DOM thingy. The DOM1+ method of getting an element on the page via its ID is: document.getElementById("box1") Firefox transparently puts access for document.all in so that any site designed by people who that that IE = the Internet wouldn't horribly break in Firefox (chances are, though, lots of other stuff will break). if (document.all) will not execute in FF, but document.all.box1 will at least work. Not with my Firefox! v2.0.0.6 Error: document.all has no properties Source File: file:///D:/Documents%20and%20Settings/Jonathan/Desktop/New%20HTML%20Document.html Line: 20 And never has. Nor with my SeaMonkey v1.1.4. Do you have some sort of extension installed? |
#6
| |||
| |||
|
|
Randell_D wrote: function hide() { document.all.box1.style.visibility="collapse"; ^^^ ^^^^^^^^ (a) (b) [...] (b) The CSS property "visibility" collapse can be used on tables but what I think your want here is to toggle the "display" property between visible and hidden |
#7
| ||||||
| ||||||
|
|
Randell_D wrote: tr><td>here</td></tr table |
|
br><a href="#" onClick="show();">Show</a br><a href="#" onClick="hide();">Hide</a |
|
function hide() { document.all.box1.style.visibility="collapse"; ^^^ ^^^^^^^^ (a) (b) (a) I highly doubt that this script "works" in Firefox. the "all" collection is MS proprietary DOM thingy. |
|
[...] (b) The CSS property "visibility" collapse can be used on tables but what I think your want here is to toggle the "display" property between visible and hidden |
|
Crack a book on the more modern DOM scripting? |
| http://www.w3.org/DOM/ W3C Document Object Model maybe some tutorials at www.htmldog.com might help. |
#8
| |||
| |||
|
|
Jonathan N. Little schrieb: Randell_D wrote: function hide() { document.all.box1.style.visibility="collapse"; ^^^ ^^^^^^^^ (a) (b) [...] (b) The CSS property "visibility" collapse can be used on tables but what I think your want here is to toggle the "display" property between visible and hidden Just for the records: Neither CSS 2 nor CSS 2.1 defines the values visible and hidden for the display property. However they are defined values for the visibility property. You are right I jumbled what I wanted to say was visibility: |
#9
| |||
| |||
|
|
Randell_D wrote: table id="box1" width="90%" border="1" cellspacing="1" cellpadding="1" summary="summary" class="box1" [snip] [...] I am curious why you have not put the "width=..." and "border=..." stuff into the "box1" CSS class. |
#10
| |||
| |||
|
|
Folks, I am cross posting this into both stylesheets and javascript groups because its valid to both. I have a page that works just beautifully in Firefox without any errors yet not in IE7. Since there is no error console screen in IE I don't know where its going wrong and my entire userbase is based unfortunately IE based. I have a the following table and javascript functions: table id="box1" width="90%" border="1" cellspacing="1" cellpadding="1" summary="summary" class="box1" tr><td>here</td></tr table br><a href="#" onClick="show();">Show</a br><a href="#" onClick="hide();">Hide</a script language="JavaScript" function hide() { document.all.box1.style.visibility="collapse"; return true; } function show() { document.all.box1.style.visibility="visible"; return true;} /script In firefox, no warnings - errors or anything - everything is displayed or hidden. In IE7 I get the message "Could not get the visibility property. Invalid argument." I have used a previously suggested method of style:display as follows: function hide() { document.all.box1.style.display="none"; return true; } function show() { document.all.box1.style.display="table"; return true; } This works perfectly again in Firefox but will HIDE the table but not re-display the table when show is called (same "Could not get the visibility property. Invalid argument." message in IE7. Can someoe tell me where I am going wrong? I am wondering if its my javascript code and my usage of DOM and would appreciate any direction you can offer.... Cheers! |
![]() |
| Thread Tools | |
| Display Modes | |
| |