CyberScout
10-18-2002, 01:09 PM
I am using a FileTree on a website that uses "function showhide" and changes images depending on if they have clicked there before.
Below is the script that runs everything. The problem comes up when I add a "what6" to the "function showhide." if I am only using up to "what5" then it works fine.
Basically it gives me an error telling me the this line:
"what6.src=button_03b.src" is 'undefinded' is null or not a defined object
as well as this line
"what6.src=button_03.src"
Any help with this would be greatly appreciated.
Thanks in advance
<script language="javascript">
<!--
var Open = ""
var Closed = ""
function preload(){
if(document.images){
Open = new Image
Closed = new Image
button_02b = new Image
button_02 = new Image
large_01b = new Image
large_01 = new Image
small_01b = new Image
small_01 = new Image
button_03b = new Image
button_03 = new Image
Open.src = "open.gif"
Closed.src = "closed.gif"
button_02b.src = "images/leftnav/button_02b.gif"
button_02.src = "images/leftnav/button_02.gif"
large_01b.src = "images/tones/large_01b.gif"
large_01.src = "images/tones/large_01.gif"
small_01b.src = "images/tones/small_01b.gif"
small_01.src = "images/tones/small_01.gif"
button_03b.src = "images/leftnav/button_03b.gif"
button_03.src = "images/leftnav/button_03.gif"
}}
function showhide(what,what2,what3,what4,what5,what6){
if (what.style.display=='none'){
what.style.display='';
what2.src=Open.src
what3.src=button_02b.src
what4.src=large_01b.src
what5.src=small_01b.src
what6.src=button_03b.src
}
else{
what.style.display='none'
what2.src=Closed.src
what3.src=button_02.src
what4.src=large_01.src
what5.src=small_01.src
what6.src=button_03.src
}
}
//-->
</script>
Below is the script that runs everything. The problem comes up when I add a "what6" to the "function showhide." if I am only using up to "what5" then it works fine.
Basically it gives me an error telling me the this line:
"what6.src=button_03b.src" is 'undefinded' is null or not a defined object
as well as this line
"what6.src=button_03.src"
Any help with this would be greatly appreciated.
Thanks in advance
<script language="javascript">
<!--
var Open = ""
var Closed = ""
function preload(){
if(document.images){
Open = new Image
Closed = new Image
button_02b = new Image
button_02 = new Image
large_01b = new Image
large_01 = new Image
small_01b = new Image
small_01 = new Image
button_03b = new Image
button_03 = new Image
Open.src = "open.gif"
Closed.src = "closed.gif"
button_02b.src = "images/leftnav/button_02b.gif"
button_02.src = "images/leftnav/button_02.gif"
large_01b.src = "images/tones/large_01b.gif"
large_01.src = "images/tones/large_01.gif"
small_01b.src = "images/tones/small_01b.gif"
small_01.src = "images/tones/small_01.gif"
button_03b.src = "images/leftnav/button_03b.gif"
button_03.src = "images/leftnav/button_03.gif"
}}
function showhide(what,what2,what3,what4,what5,what6){
if (what.style.display=='none'){
what.style.display='';
what2.src=Open.src
what3.src=button_02b.src
what4.src=large_01b.src
what5.src=small_01b.src
what6.src=button_03b.src
}
else{
what.style.display='none'
what2.src=Closed.src
what3.src=button_02.src
what4.src=large_01.src
what5.src=small_01.src
what6.src=button_03.src
}
}
//-->
</script>