Results 1 to 3 of 3

Thread: Newbie Question

  1. #1
    Join Date
    Dec 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Newbie Question

    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?

  2. #2
    Join Date
    Sep 2004
    Location
    Little Falls, Roodepoort, South Africa
    Posts
    421
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

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

    should work, rgds,Simonf

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by simonf
    <body onLoad="if (document.all&&window.print) readymessage()", "init()">

    should work
    No, it shouldn't.

    HTML Code:
    <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:

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

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •