W
westplastic
This one is driving me insane. The script works perfect on Firefox,
but Internet Explorer keeps complaining about "Error Object Expected"
and stuff like that. I've run it through Firefox's Java Console, and
it comes back with no errors. Any pointers on this, would be much
appreciated.
<script type="text/javascript">
<!--
var p = new Array(0,0,0,0,0)
var c = new Array(0,0,0,0,0,0,0,0,0)
var classes = new Array(5)
classes[0] = "<a href='javascript:class(0)'>ASM2O<\/a><div
id='c0'><\/div><a href='javascript:class(1)'>PPL2O<\/a><div
id='c1'><\/div>"
classes[1] = "<a href='javascript:class(2)'>SNC2D<\/a><div
id='c2'><\/div><a href='javascript:class(3)'>CHC2D<\/a><div
id='c3'><\/div>"
classes[2] = "<a href='javascript:class(4)'>ENG2D<\/a><div
id='c4'><\/div><a href='javascript:class(5)'>MPM2D<\/a><div
id='c5'><\/div>"
classes[3] = "<a href='javascript:class(6)'>break<\/a><div
id='c6'><\/div>"
classes[4] = "<a href='javascript:class(7)'>GLC2O<\/a><div
id='c7'><\/div><a href='javascript:class(8)'>BBI2O<\/a><div
id='c8'><\/div>"
var hom = new Array(8)
hom[0] = "<ul><li>Motion tweening<\/li><li>Shape
tweening<\/li><li>Splice<\/li><li>Motion guides<\/li><\/ul>"
hom[1] = "<ul><li>Stuff<\/li><\/ul>"
hom[2] = "<ul><li>Megatransect II<\/li><li>Worksheet<\/li><li>10.3
#1-14<\/li><\/ul>"
hom[3] = "<ul><li>Stuff<\/li><\/ul>"
hom[4] = "<ul><li>Read 2.1<\/li><li>Redo journal<\/li><\/ul>"
hom[5] = "<ul><li>Stuff<\/li><\/ul>"
hom[6] = "<ul><li>You think you can get homework from a lunch
period?<\/li><\/ul>"
hom[7] = "<ul><li>Technology careers presentation<\/li><\/ul>"
hom[8] = "<ul><li>Stuff<\/li><\/ul>"
function display(period){
if(p[period]==0){
document.getElementById("p"+period).innerHTML=classes[period]
p[period]=1
}
else{
document.getElementById("p"+period).innerHTML=""
p[period]=0
}
}
function class(num){
if(c[num]==0){
document.getElementById("c"+num).innerHTML=hom[num]
c[num]=1
}
else{
document.getElementById("c"+num).innerHTML=""
c[num]=0
}
}
//-->
</script>
----------------------------------------------------------------------------
You can see the script in context here:
http://www.freewebs.com/cisbase/MichaelSource/homework.html
The gist of it, is that a link is clicked which calls display(period).
This will then display the appropriate element from classes[] which in
turn provides a link that calls class(num) and displays the
corresponding element from hom[]
Again, works nice on Firefox.
Internet Explorer:
Upon loading, it gives this error:
Line: 42
Char: 10
Error: Expected '('
Code: 0
And when clicking one of the links it gives this error
Line: 1
Char: 1
Error: Object Expected
Code: 0
but Internet Explorer keeps complaining about "Error Object Expected"
and stuff like that. I've run it through Firefox's Java Console, and
it comes back with no errors. Any pointers on this, would be much
appreciated.
<script type="text/javascript">
<!--
var p = new Array(0,0,0,0,0)
var c = new Array(0,0,0,0,0,0,0,0,0)
var classes = new Array(5)
classes[0] = "<a href='javascript:class(0)'>ASM2O<\/a><div
id='c0'><\/div><a href='javascript:class(1)'>PPL2O<\/a><div
id='c1'><\/div>"
classes[1] = "<a href='javascript:class(2)'>SNC2D<\/a><div
id='c2'><\/div><a href='javascript:class(3)'>CHC2D<\/a><div
id='c3'><\/div>"
classes[2] = "<a href='javascript:class(4)'>ENG2D<\/a><div
id='c4'><\/div><a href='javascript:class(5)'>MPM2D<\/a><div
id='c5'><\/div>"
classes[3] = "<a href='javascript:class(6)'>break<\/a><div
id='c6'><\/div>"
classes[4] = "<a href='javascript:class(7)'>GLC2O<\/a><div
id='c7'><\/div><a href='javascript:class(8)'>BBI2O<\/a><div
id='c8'><\/div>"
var hom = new Array(8)
hom[0] = "<ul><li>Motion tweening<\/li><li>Shape
tweening<\/li><li>Splice<\/li><li>Motion guides<\/li><\/ul>"
hom[1] = "<ul><li>Stuff<\/li><\/ul>"
hom[2] = "<ul><li>Megatransect II<\/li><li>Worksheet<\/li><li>10.3
#1-14<\/li><\/ul>"
hom[3] = "<ul><li>Stuff<\/li><\/ul>"
hom[4] = "<ul><li>Read 2.1<\/li><li>Redo journal<\/li><\/ul>"
hom[5] = "<ul><li>Stuff<\/li><\/ul>"
hom[6] = "<ul><li>You think you can get homework from a lunch
period?<\/li><\/ul>"
hom[7] = "<ul><li>Technology careers presentation<\/li><\/ul>"
hom[8] = "<ul><li>Stuff<\/li><\/ul>"
function display(period){
if(p[period]==0){
document.getElementById("p"+period).innerHTML=classes[period]
p[period]=1
}
else{
document.getElementById("p"+period).innerHTML=""
p[period]=0
}
}
function class(num){
if(c[num]==0){
document.getElementById("c"+num).innerHTML=hom[num]
c[num]=1
}
else{
document.getElementById("c"+num).innerHTML=""
c[num]=0
}
}
//-->
</script>
----------------------------------------------------------------------------
You can see the script in context here:
http://www.freewebs.com/cisbase/MichaelSource/homework.html
The gist of it, is that a link is clicked which calls display(period).
This will then display the appropriate element from classes[] which in
turn provides a link that calls class(num) and displays the
corresponding element from hom[]
Again, works nice on Firefox.
Internet Explorer:
Upon loading, it gives this error:
Line: 42
Char: 10
Error: Expected '('
Code: 0
And when clicking one of the links it gives this error
Line: 1
Char: 1
Error: Object Expected
Code: 0