473,396 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

why this code doesn't work in firefox?

wgale025
[HTML]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>drag</title>
<style>
<!--.drag{position:relative;}
-->
</style>
<script language="JavaScript">
String.prototype.inc=function(s){return this.indexOf(s)>-1?true:false}
var agent=navigator.userAgent
window.isOpr=agent.inc("Opera")
window.isIE=agent.inc("IE")&&!isOpr
window.isMoz=agent.inc("Mozilla")&&!isOpr&&!isIE

var dragapproved=false
var z,x,y,t1,t2
function move(){
var oEvent=null,oElement=null;
if(isMoz){
oEvent=arguments[0];
oElement=oEvent.target;
}else{
oEvent=window.event;
oElement=oEvent.srcElement;
}
if (oEvent.button==1&&dragapproved){
//z.style.pixelLeft=temp1+oEvent.clientX-x
//z.style.pixelTop=temp2+oEvent.clientY-y
z.style.pixelLeft=t1+oEvent.clientX-x
z.style.pixelTop=t2+oEvent.clientY-y
return false
}}
function drags(){
var oEvent=null,oElement=null;
if(isMoz){
oEvent=arguments[0];
oElement=oEvent.target;
}else{
oEvent=window.event;
oElement=oEvent.srcElement;
}
if (oElement.className=="drag"){
dragapproved=true
z=oElement;
t1=z.style.pixelLeft
t2=z.style.pixelTop
x=oEvent.clientX
y=oEvent.clientY
document.onmousemove=move
}}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
</script>
</head><body>
<img src="http://www.hongen.com/pc/homepage/javascript/sample/img/draw.jpg" class="drag"></body>
</html>

[/HTML]

it works in IE very well.
May 15 '07 #1
1 1485
pbmods
5,821 Expert 4TB
it works in IE very well.
Fantastic. What does it do? And what doesn't it do in Firefox? Are you getting an error?
May 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Cliff R. | last post by:
Hi, I use a handy little Javascript Flash detection script on a number of sites (copied below). Usually works great, but I just started trying Firefox and it's not working. A few browsers are...
3
by: Lachlan Hunt | last post by:
Hi, I've been looking up lots of documentation and trying to work out a cross-platform method of capturing a keyboard event and working out which key was pressed. From what I can find, there...
8
by: bradwiseathome | last post by:
I have code that works in IE 6 but does not work in FireFox 1.0.2, how can I change it so it works in both browsers? <html> <head> <script language="JavaScript" type="text/JavaScript">...
10
by: Geoff Cox | last post by:
Hello, The Javascript code at the URL below does work but no doubt there are better ways of coding the app so would appreciate any comments! ...
45
by: Pat | last post by:
its seems asp.net validation doesn't fire when using FireFox? Tested a page and it doesn't fire. It seems the javascript doesn't fire Any ideas?
21
by: briggs | last post by:
<html> <head> <script> /* AddChild */ function ac() { var c; var p = document.getElementById("p"); for (var i = 0; i < 5; i++) { c = document.createElement("DIV"); // Create 'div' element.
1
by: ashim | last post by:
Hi Everyone, Please help me to solve a problem. I wrote a JavaScript code, but FireFox and IE have different results. The code is: alert (parent.frame2.location);...
23
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser...
2
by: Andrew Bailey | last post by:
Hi, Thanks for reading and Merry Christmas, My popup code doesn't appear to work with Internet Explorer 7 and before I spend time bug hunting I would appreciate it if a few IE7 users could...
7
by: John Kotuby | last post by:
Hi all, I have created an ASPX page in VS 2008 that appears inside of an IFRAME inside a standard HTML page. Because it loads from an external site and is database driven, the first load takes a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.