Results 1 to 5 of 5

Thread: [RESOLVED] This means what

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    233

    Resolved [RESOLVED] This means what

    hi can anyone explain, this statement means what.. thanks

    Code:
    document.all?
    The taller the bamboo grows the lower it bends...

  2. #2
    Hyperactive Member coothead's Avatar
    Join Date
    Oct 2007
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    285

    Re: This means what

    Hi there JJJCR_FOX,

    document.all is IE propriety code and this is it's definition...

    A collection of elements nested within the current element.
    A reference to document.all, for example, returns a collection (array)
    of all element objects contained by the document, including elements
    that may be deeply nested inside the document's first level of elements.

    Here is an example...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    
    <title></title>
    
    <style type="text/css"></style>
    
    <script type="text/javascript">
    if(window.addEventListener){
       window.addEventListener('load',init,false);
     }
    else {
    if(window.attachEvent) {
       window.attachEvent('onload',init);
      }
     }
    
    function init() {
    if(document.all){
    for(c=0;c<document.all.length;c++){
       alert(document.all[c].tagName);
      }
     }
    else {
      alert('document.all is not supported');
      }
     }
    </script>
    
    </head>
    <body>
    
    <ul>
     <li>list one</li>
     <li>list two</li>
     <li>list three</li>
     <li>list four</li>
    </ul>
    
    </body>
    </html>
    


    ~ the original bald headed old fart ~

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    233

    Re: This means what

    ok, thanks for that..but i have seen a code with that statement with a question mark at the end of the statement..is a question mark a javascript operator or what? like ! it's a not operator in javascript, how about this ? it means what? thanks again...
    The taller the bamboo grows the lower it bends...

  4. #4
    Fanatic Member
    Join Date
    Jul 2001
    Location
    London UK
    Posts
    671

    Re: This means what

    Might be part of a statement using the javascript ternary operator.

    The syntax for this is...

    condition ? value if true : value if false

    so the statement

    document.all ? x : y;

    means do x if document.all doesn't evaluate to false (i.e. is supported) or do y otherwise.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    233

    Re: This means what

    ohhh..thank you so much for sharing your knowledge..
    The taller the bamboo grows the lower it bends...

Posting Permissions

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



Click Here to Expand Forum to Full Width