Results 1 to 8 of 8

Thread: Are the standards and Opera correct and I'm wrong?...

  1. #1

    Thread Starter
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645

    Are the standards and Opera correct and I'm wrong?...

    Hi,

    The below code shows a simple button with some javascript executing on it.

    This code is tested and works in IE6, NS6, Mozilla 0.99 but doesnt work in Opera.

    So my question is, is Opera correctly and you not supposed to execute Javascript through an event attribute this way (as part of the standard), or am I correct and Opera 6 is at fault? I cant find anything on W3s site saying that I'm incorrect.

    Any feedback would be appreciated.

    Code:
    <html> 
    <head> 
    <title>Untitled</title> 
    </head> 
    <body> 
    <input type="button" value="Click Me!" onclick="javascript:tmp=prompt('Enter Something','');if (tmp==null){alert('You clicked Cancel');}else{alert('You typed ' + tmp);}">
    </body> 
    </html>
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I'm gonna guess it has something to do with the preceding "javascript:" text - the examples @w3.org don't have this, and only show javascript done this way - the VBScript or Tcl examples use full fledged <script> tags.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    I don't know, and I haven't checked, but I always declare variables. You may not have to. Maybe "var tmp=prompt" instead of "tmp=prompt".

    Just throwing ideas.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  4. #4

    Thread Starter
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Thanks Guys,
    I'll check it out and see what I come up with.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  5. #5
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    I tried both those suggestions already and they don't work. The only solution I could find was to put the onclick stuff in a function. Must be an Opera bug

  6. #6

    Thread Starter
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Thanks Rick, must be an OP
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  7. #7

    Thread Starter
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Thanks Rick, must be an Opera limitation
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  8. #8
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    That's OK L-Man (private joke ). Why don't you try asking on the Opera forums? Although I've been there once, I can't seem to find the link from their page If you find it let me know

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