K
kj
This problem is driving me nuts. The code at the end of this post
below works fine with IE, but fails with Mozilla. You can see it
in action at
http://tinyurl.com/2jvo3
With Mozilla 1.4 and 1.6, the function msg works fine if it's
installed as an onclick handler for the button, but fails as an
onload handler for the page. The error is "console has no properties",
and is triggered by the line.
console.document.open("text/plain");
The code works fine on all versions of IE I've tested it on.
Is there an error in my code (that IE is letting slide), or is this
a bug in Mozilla? If the latter, is there a workaround?
Thanks!
kj
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head><title>JAVASCRIPT STUMPER</title></head>
<body onload="javascript:msg('PLEASE HELP ME!!!') // bombs on NS, moz">
<script type="text/javascript">
// Adapted from Flanagan's "JavaScript: The Definitive Guide", 3rd Ed.
var console = null;
var litany = "";
var times = 0;
function msg(s) {
var MHUAHAHA = "";
if ((console == null) || (console.closed)) {
console = window.open("","console","width=600,height=300,resizable");
console.document.open("text/plain");
MHUAHAHA = litany;
}
MHUAHAHA += (++times > 1
? "I've told you " + times + " times already!!! "
: "") + "RESISTANCE IS FUTILE!\n";
console.document.write(MHUAHAHA);
litany = MHUAHAHA;
}
</script>
<h1>ALL YOUR BASE ARE BELONG TO US!</h1>
<form>
<input type=button value="HELP!!!" onclick="javascript:msg(this.value)"/>
</form>
</body>
</html>
below works fine with IE, but fails with Mozilla. You can see it
in action at
http://tinyurl.com/2jvo3
With Mozilla 1.4 and 1.6, the function msg works fine if it's
installed as an onclick handler for the button, but fails as an
onload handler for the page. The error is "console has no properties",
and is triggered by the line.
console.document.open("text/plain");
The code works fine on all versions of IE I've tested it on.
Is there an error in my code (that IE is letting slide), or is this
a bug in Mozilla? If the latter, is there a workaround?
Thanks!
kj
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head><title>JAVASCRIPT STUMPER</title></head>
<body onload="javascript:msg('PLEASE HELP ME!!!') // bombs on NS, moz">
<script type="text/javascript">
// Adapted from Flanagan's "JavaScript: The Definitive Guide", 3rd Ed.
var console = null;
var litany = "";
var times = 0;
function msg(s) {
var MHUAHAHA = "";
if ((console == null) || (console.closed)) {
console = window.open("","console","width=600,height=300,resizable");
console.document.open("text/plain");
MHUAHAHA = litany;
}
MHUAHAHA += (++times > 1
? "I've told you " + times + " times already!!! "
: "") + "RESISTANCE IS FUTILE!\n";
console.document.write(MHUAHAHA);
litany = MHUAHAHA;
}
</script>
<h1>ALL YOUR BASE ARE BELONG TO US!</h1>
<form>
<input type=button value="HELP!!!" onclick="javascript:msg(this.value)"/>
</form>
</body>
</html>