|
-
Apr 16th, 2001, 02:52 PM
#1
Thread Starter
Frenzied Member
Okay, I have two pages. One works in Navigator, the other doesn't. They both work in IE. Would you guys look them over and tell me what is wrong?
Code:
<head>
<script language='JavaScript' src='DynEl.js'></script>
<script language='JavaScript'>
var table1 = " "
var table2 = "More test text"
var dynel1 = new DynEl(window, "d1", table1);
var dynel2 = new DynEl(window, "d2", table2);
</script>
</head>
<body onload='JavaScript:Init();'>
<a href="JavaScript:Toggle('1');">Show 1</a>
<a href="JavaScript:Toggle('2');">Show 2</a>
<script language='JavaScript'>
dynel1.output();
dynel2.output();
// In Navigator these two lines do not
//appear to have been executed
dynel1.setBody("blah");
dynel1.setBody("foo", "bar");
</script>
<script language='JavaScript'>
function Init() {
Toggle('1');
}
function Toggle(index) {
index = parseInt(index);
dynel1.hide();
dynel2.hide();
if (index == 1) {
dynel1.show();
}
else if (index == 2) {
dynel2.show();
}
}
</script>
</body>
Code:
<head>
<script language='JavaScript' src='DynEl.js'></script>
<script language='JavaScript'>
var table1 = " "
var table2 = "More test text"
var dynel1 = new DynEl(window, "d1", table1);
var dynel2 = new DynEl(window, "d2", table2);
</script>
</head>
<body onload='JavaScript:Init();'>
<a href="JavaScript:Toggle('1');">Show 1</a>
<a href="JavaScript:Toggle('2');">Show 2</a>
<script language='JavaScript'>
dynel1.output();
dynel2.output();
//But if I wrap these lines in a function
//and use an event to call that function... it work
function doRun() {
dynel1.setBody("blah");
dynel1.setBody("foo", "bar");
}
</script>
<script language='JavaScript'>
function Init() {
Toggle('1');
doRun();
}
function Toggle(index) {
index = parseInt(index);
dynel1.hide();
dynel2.hide();
if (index == 1) {
dynel1.show();
}
else if (index == 2) {
dynel2.show();
}
}
</script>
</body>
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|