works in Opera and IE but not FF or Chrome - why?

E

Evertjan.

123Jim wrote on 07 mei 2011 in comp.lang.javascript:
Hi all, Please take a look at my test page, why does it work in Opera
and IE but not in Firefox or Chrome?

http://myweb.tiscali.co.uk/ladycroft/webdevfun/drag_and_drop_javascript
.html

You do not specify what you want it to do.

Looking at the code:

<style>
<!--
..dragme{position:relative;}
-->
</style>

<script language="JavaScript1.2">
<!--


Wow, that is code of last century,
better learn some Javascript by perusing the NG-faq and the NG-content.
 
1

123Jim

Evertjan. said:
123Jim wrote on 07 mei 2011 in comp.lang.javascript:


You do not specify what you want it to do.

Looking at the code:

<style>
<!--
.dragme{position:relative;}
-->
</style>

<script language="JavaScript1.2">
<!--


Wow, that is code of last century,
better learn some Javascript by perusing the NG-faq and the NG-content.

Turns out the code did not work in FF and Chrome because they did not like
my choice of the strict 4.01 doctype (for this code) .. There may be other
problems in the code but it now seems to work fine in the four browsers I
tested.
 
D

David Dorward

Turns out the code did not work in FF and Chrome because they did not like
my choice of the strict 4.01 doctype (for this code) .. There may be other
problems in the code but it now seems to work fine in the four browsers I
tested.

You've got it backwards, they didn't like the errors in the code.

With the Doctype you trigger Standards mode, and browsers follow the
specifications more precisely. I'm not going to fully debug that pre-
millennial code, but one obvious problem is that it tries to set
integer values to the left and top properties - but they take lengths,
but must have units if they have a value other than 0.
 
E

Evertjan.

123Jim wrote on 08 mei 2011 in comp.lang.javascript:
Turns out the code did not work in FF and Chrome because they did not
like my choice of the strict 4.01 doctype (for this code) .. There may
be other problems in the code but it now seems to work fine in the
four browsers I tested.

Perhaps, but aren't you interested in the "why"?

And don't you want code that does not lead you to unexpected surprises to
users that perhaps won't report back to you?
 
1

123Jim

Evertjan. said:
123Jim wrote on 08 mei 2011 in comp.lang.javascript:


Perhaps, but aren't you interested in the "why"?

And don't you want code that does not lead you to unexpected surprises to
users that perhaps won't report back to you?


Affirmative ..
Currently I'm looking at this:
http://www.jslint.com/
 
1

123Jim

You've got it backwards, they didn't like the errors in the code.
With the Doctype you trigger Standards mode, and browsers follow the
specifications more precisely. I'm not going to fully debug that pre-
millennial code, but one obvious problem is that it tries to set
integer values to the left and top properties - but they take lengths,
but must have units if they have a value other than 0.


Agreed . .I'll look into it
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top