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

Need some help...

Expand Messages
  • angalodehaberdasheri
    var abc = container.style.pixelLeft;  
    Message 1 of 1 , Dec 6, 2001
    • 0 Attachment
      var abc = container.style.pixelLeft;
      <div id="container" style="position:absolute; left:500;"> </div>
      <button onclick="alert(abc);">Hello</button>
      <button onclick="alert(container.style.pixelLeft);">Bye bye</button>

      When I click on the "Hello" button, the window popup
      shows "undefined".

      1)Also, when I click "Bye bye" the window popup shows "500" which is

      2)when I set var abc = 1 or some other number, when I click
      on "Hello" the window popup shows the number correctly.

      3)I've also tried var abc = document.container.style.pixelLeft;

      I think the script cannot access the attributes of the "container"
      Can anyone help here? How do I access a HTML element's attributes
      from within a script?

    Your message has been successfully submitted and would be delivered to recipients shortly.