PDA

View Full Version : Newbie Question



Bracolla
12-31-2004, 05:32 PM
I need to add the following to the <BODY> tag:

<body onLoad="if (document.all&&window.print) readymessage()">

but the <Body> tag already contains <body onload="init()">

How can I combine both?

simonf
01-06-2005, 05:38 AM
<body onLoad="if (document.all&&window.print) readymessage()", "init()">

should work, rgds,Simonf;)

mwinter
01-06-2005, 11:09 AM
<body onLoad="if (document.all&&window.print) readymessage()", "init()">

should workNo, it shouldn't.


<body onload="if(document.all && window.print){readymessage();}init();">
However, if the if statement is meant to detect IE, it would be better to use Internet Explorer's conditional comments:


<body onload="init();">
<!--[if IE]>
<script type="text/javascript">
(function(fn) {
window.onload = function() {
readymessage();
if(fn) {fn();}
};
})(window.onload);
</script>
<![endif]-->
[Untested]

Mike