Loading ...
Sorry, an error occurred while loading the content.
 

Re: Event Handlers as JavaScript Properties (goes in

Expand Messages
  • zcarcharodon
    I ve answered my own question/post. I knew there was something wrong with that code in the book. It is actually known errata. Page 288. I needed to go through
    Message 1 of 4 , May 22, 2008
      I've answered my own question/post.
      I knew there was something wrong with that code in the book. It is
      actually known errata. Page 288. I needed to go through the forms
      array or name of form first before I could type the button name. I'm
      kinda new to JavaScript, I didn't know what was going on, damn book!

      Here is the errata from their site:
      http://www.oreilly.com/catalog/9781565923928/errata/9781565923928.300

      {288} 3rd line of code:
      did read:
      document.b1.onclick = ...
      now reads:
      document.forms[0].b1.onclick = ...
    • Jon Stephens
      ... You can get the window s onload handler as window.onload, like this: window.onload = clickMe; // window.onload = ... function
      Message 2 of 4 , May 25, 2008
        > I've answered my own question/post.
        > I knew there was something wrong with that code in the book. It is
        > actually known errata. Page 288. I needed to go through the forms
        > array or name of form first before I could type the button name. I'm
        > kinda new to JavaScript, I didn't know what was going on, damn book!
        >
        > Here is the errata from their site:
        > http://www.oreilly.com/catalog/9781565923928/errata/9781565923928.300
        >
        > {288} 3rd line of code:
        > did read:
        > document.b1.onclick = ...
        > now reads:
        > document.forms[0].b1.onclick = ...


        You can get the window's onload handler as window.onload, like this:

        window.onload = clickMe; // window.onload = ... <-> <body onload="...">

        function clickMe()
        {
        document.forms[0].b1.onclick = function() {alert("Thanks!");};
        }

        or even like this:

        window.onload
        = function()
        {
        document.forms[0].b1.onclick
        = function()
        {
        alert("Thanks!");
        };
        };

        Note that in the first case, you're not invoking the clickMe function directly,
        but rather referencing it as a Function object, which is why there are no
        parentheses in the statement "window.onload = clickMe;"

        cheers

        jon.

        --
        This message has not been scanned for viruses.

        Since I do not use a Microsoft operating
        system or software, and use only plaintext
        for email, there is little need for me to do so.
      • MEL
        Hi: Is this possible that i can create a vertical thick line on the left side as a left vertical border on the page? Thanks.
        Message 3 of 4 , May 31, 2008
          Hi: Is this possible that i can create a vertical thick line on the left side as a left vertical border on the page?
          Thanks.

          <html>
          <head>
          <style type="text/css">
          a {
          color: 'yellow';
          font-size: smaller;
          }
          a:hover {
          color: #CC0033;
          font-size: larger;
          }
          </style>
          </head>
          <body>
          <!--img style="float:right;" src="smeg.jpg" />
          <div style="width:100%;color:#FFFFFF;background:black;padding-top:3px;font-family:Georgia,Times;font-size:54px;font-weight:bold;line-height:1em;padding-
          bottom:5px;">
          <span title="Link to Home" onmouseover="this.style.color='#F60';" onmouseout="this.style.color='#FFFFFF';">NORTH EAST SERVICES</span>
          </div>
          <div style="background:black;font-family:geneva,arial;color:#F60;font-size:12px;font-weight:bold;padding-left:5px;">3235 PARK SIDE PLACE</div>
          <div style="background:black;font-family:geneva,arial;color:#F60;font-size:12px;font-weight:bold;padding-left:5px;">PHONE (631) 222-2270 FAX (631) 335-
          2247</div>
          <div style="background:black;font-family:geneva,arial;color:#F60;font-size:12px;font-weight:bold;padding-left:5px;">Office Hours: Monday to Friday (8:00 AM
          to 5:00 PM)</div>
          <div style="width:100%;background:#F60;text-align:center;font-size:small;padding-top:8px;font-family:system,geneva;font-weight:bold;">
          <a href="mk.html">PEDIATRIC NEUROLOGY</a>     <a href="mdjk.html">ADULT NEUROLOGY</a>     <a href="direcs.html">DIRECTIONS TO OUR
          OFFICE</a>     <a href="tstprf.html">TEST PERFORMED IN OUR OFFICE</a>
          </div>
          <div style="width:100%; text-align:center">
          <span style="margin-right:6px;margin-top:5px;color:white;background:green;border:1px solid darkkhaki;font-size:30px;line-height:60px;padding-
          top:2px;padding-right:5px;font-family:times;">SPECIALIZING IN PEDIATRIC AND ADULT NEUROLOGY</span><div style="clear:both;"><br></div>
          </div>
          <BR><BR>




          [Non-text portions of this message have been removed]
        • Tim Sabin
          This doesn t require JavaScript. See this page for a description of tables: http://www.w3.org/TR/REC-html40/struct/tables.html Pay special attention to the
          Message 4 of 4 , May 31, 2008
            This doesn't require JavaScript. See this page for a description of
            tables: http://www.w3.org/TR/REC-html40/struct/tables.html
            Pay special attention to the part about the TD tag and rowspan. In the
            cell on the left, include a proper <img> tag.

            --Tim Sabin


            MEL wrote:
            > Hi: Is this possible that i can create a vertical thick line on the left side as a left vertical border on the page?
            > Thanks.
            >
            > <html>
            > <head>
            > <style type="text/css">
            > a {
            > color: 'yellow';
            > font-size: smaller;
            > }
            > a:hover {
            > color: #CC0033;
            > font-size: larger;
            > }
            > </style>
            > </head>
            > <body>
            > <!--img style="float:right;" src="smeg.jpg" />
            > <div style="width:100%;color:#FFFFFF;background:black;padding-top:3px;font-family:Georgia,Times;font-size:54px;font-weight:bold;line-height:1em;padding-
            > bottom:5px;">
            > <span title="Link to Home" onmouseover="this.style.color='#F60';" onmouseout="this.style.color='#FFFFFF';">NORTH EAST SERVICES</span>
            > </div>
            > <div style="background:black;font-family:geneva,arial;color:#F60;font-size:12px;font-weight:bold;padding-left:5px;">3235 PARK SIDE PLACE</div>
            > <div style="background:black;font-family:geneva,arial;color:#F60;font-size:12px;font-weight:bold;padding-left:5px;">PHONE (631) 222-2270 FAX (631) 335-
            > 2247</div>
            > <div style="background:black;font-family:geneva,arial;color:#F60;font-size:12px;font-weight:bold;padding-left:5px;">Office Hours: Monday to Friday (8:00 AM
            > to 5:00 PM)</div>
            > <div style="width:100%;background:#F60;text-align:center;font-size:small;padding-top:8px;font-family:system,geneva;font-weight:bold;">
            > <a href="mk.html">PEDIATRIC NEUROLOGY</a>     <a href="mdjk.html">ADULT NEUROLOGY</a>     <a href="direcs.html">DIRECTIONS TO OUR
            > OFFICE</a>     <a href="tstprf.html">TEST PERFORMED IN OUR OFFICE</a>
            > </div>
            > <div style="width:100%; text-align:center">
            > <span style="margin-right:6px;margin-top:5px;color:white;background:green;border:1px solid darkkhaki;font-size:30px;line-height:60px;padding-
            > top:2px;padding-right:5px;font-family:times;">SPECIALIZING IN PEDIATRIC AND ADULT NEUROLOGY</span><div style="clear:both;"><br></div>
            > </div>
            > <BR><BR>
            >
            >
            >
            >
            > [Non-text portions of this message have been removed]
            >
            >
            > ------------------------------------
            >
            > Visit http://aiaiai.com for more groups to joinYahoo! Groups Links
            >
            >
            >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.