Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 35

Thread: [DHTML] No Right Click

  1. #11
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Because it's shorter than false. Also, I've just realised that if 0 will work undefined will too, so it's not necessary to return anything, and edited accordingly.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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

    Default

    Quote Originally Posted by Twey View Post
    XHTML requires the quotes around the type attribute.
    So does HTML.

    Quote Originally Posted by Twey View Post
    Also, I've just realised that if 0 will work undefined will too, so it's not necessary to return anything, and edited accordingly.
    The value undefined is usually a special case though for event listeners. Ignoring it, or treating it like boolean true, allows authors to write event listeners without having to always return a value. I haven't checked if this applies here.

    Mike

  3. #13
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Quote Originally Posted by mwinter
    So does HTML.
    Truly? The validator says otherwise: a bug?
    The value undefined is usually a special case though for event listeners. Ignoring it, or treating it like boolean true, allows authors to write event listeners without having to always return a value. I haven't checked if this applies here.
    Hm, best return 0 then, I suppose.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #14
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Does null have the same value as 0 or false?
    - Mike

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

    Default

    Quote Originally Posted by Twey View Post
    Truly?
    Yes. What you posted is technically equivalent to (line breaks added for clarity):

    HTML Code:
    <script type="text">
    javascript&gt;document.oncontextmenu=function(){}&lt;
    </script>
    script&gt;
    Of course, no browser will see it that way, but the validator does. If only the parse tree option was still available...

    The validator says otherwise: a bug?
    Doubtful. Can you post the snippet of code you used?

    Quote Originally Posted by mburt View Post
    Does null have the same value as 0 or false?
    No. It's its own value and type. If you meant, "Does it type-convert to boolean false like 0 and false?", then yes.

    Mike

  6. #16
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The precise code was:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
      <head>
        <title></title>
        <script type=text/javascript>document.oncontextmenu=function(){return 0}</script>
      </head>
      <body><p></body>
    </html>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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

    Default

    Quote Originally Posted by mwinter View Post
    Yes. What you posted is technically equivalent to (line breaks added for clarity):

    HTML Code:
    <script type="text">
    javascript&gt;document.oncontextmenu=function(){}&lt;
    </script>
    script&gt;
    I made an incorrect assumption: a NET-enabled start-tag doesn't need to be closed with a NET; any end-tag will do.

    The "real" equivalence is:

    HTML Code:
    <script type="text">
    javascript&gt;document.oncontextmenu=function(){}
    </script>
    As you can see, this is valid, but not "correct".

    Mike

  8. #18
    Join Date
    Apr 2007
    Location
    New York
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry to spam this very interesting discussion (no sarcasm intentended), but why are we talking about ways to shorten a useless script?

  9. #19
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Academic curiosity?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #20
    Join Date
    Apr 2007
    Location
    New York
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Academic curiosity?
    Works for me Just out of curiosity, any way to get this script working in Opera? Not that I'd ever put it on a page, but in the interest of "academic curiosity"...

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
  •