|
-
May 15th, 2002, 07:23 AM
#1
Thread Starter
Fanatic Member
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>
-
May 15th, 2002, 08:45 AM
#2
Black Cat
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.
-
May 15th, 2002, 08:52 AM
#3
Frenzied Member
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.
-
May 15th, 2002, 09:01 AM
#4
Thread Starter
Fanatic Member
Thanks Guys,
I'll check it out and see what I come up with.
-
May 15th, 2002, 09:04 AM
#5
Frenzied Member
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
-
May 15th, 2002, 03:18 PM
#6
Thread Starter
Fanatic Member
Thanks Rick, must be an OP
-
May 15th, 2002, 03:18 PM
#7
Thread Starter
Fanatic Member
Thanks Rick, must be an Opera limitation
-
May 16th, 2002, 05:57 AM
#8
Frenzied Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|