Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Closed Thread
Mouse events in firefox, javascript
Old 10-13-2004, 01:22 AM Mouse events in firefox, javascript
labintador's Avatar
Skilled Talker

Posts: 96
Trades: 0
I tried to capture mouse position in firefox how come its not working in it?

event.y and event.x doesnt work and others.
labintador is offline
View Public Profile
 
 
Register now for full access!
Old 10-13-2004, 03:24 PM
Extreme Talker

Posts: 160
Trades: 0
Try event.clientX and event.clientY

HTH
ElectricSheep is offline
View Public Profile
 
Old 10-14-2004, 04:50 PM
labintador's Avatar
Skilled Talker

Posts: 96
Trades: 0
event.clientX and event.clientY didnt work.
labintador is offline
View Public Profile
 
Old 10-14-2004, 05:39 PM
Extreme Talker

Posts: 160
Trades: 0
Are you sure? Try this code and click anywhere on the page.

<html>
<head>
<title>Event</title>
</head>
<body onclick="alert(event.clientX + ' x ' + event.clientY)">
</body>
</html>
ElectricSheep is offline
View Public Profile
 
Old 10-14-2004, 05:58 PM
labintador's Avatar
Skilled Talker

Posts: 96
Trades: 0
It wokrd , i dont know buts its not working with the script im making, im trying to drag a layer. maybe i forgot something.

wht about the .offsetX and .offsetY does this work on firefox? i made a dropdown menu using this two and it wont work with firefox also.
labintador is offline
View Public Profile
 
Old 10-15-2004, 12:07 PM
labintador's Avatar
Skilled Talker

Posts: 96
Trades: 0
Heres is the script i still cant make it work with firefox and maybe will not work with netsacape either. i have no idea really, need help .

Code:
<script language=javascript>

document.write("<div id='tip' style='position:absolute;visibility:hidden;left:100;top:100' ><table borderstyle=outset border=0 bgcolor=#00c00c bordercolor=#ffffff><td id=message><br></td></table></div>"); 

	function tip(msg)
	{	
		document.all.message.innerHTML="<font color=#FFFFFF size=2 face=arial>"+msg+"</font>";
		twnd=document.all.tip;
		twnd.style.visibility="visible";
		twnd.style.top=event.clienY+19+document.body.scrollTop;
		twnd.style.left=event.clienX-2+document.body.scrollLeft;
	}

	function hide(){twnd.style.visibility="hidden";}

</script>
labintador is offline
View Public Profile
 
Old 10-15-2004, 01:46 PM
Extreme Talker

Posts: 160
Trades: 0
Ah, I see the problem. You are using Microsoft's Document Object Model. This works in IE 4+, Opera and Konqeuror.
I have modified your code so that it should work in IE DOM friendly browsers and W3C DOM friendly browsers (such as Mozilla, Netscape and Epiphany).
In actual fact you need only use the W3C DOM as this will work in IE 5+, Opera and Konqueor etc anyway, but I've left the IE DOM in case you're catering for IE4 users.
Click anywhere on the page to get the pop up message, move the mouse to lose it.
I don't use Windows so have not tested it in IE but it does work using .all under Konqueror and using getElementById in a variety of browsers.

HTH

<html>
<head>
<title></title>
</head>
<body>
<script language="javascript" type="text/javascript">

document.write("<div id='tip' style='position:absolute;visibility:hidden;left:10 0;top:100'><table borderstyle=outset border=0 bgcolor=#00c00c bordercolor=#ffffff><td id=message><br></td></table></div>");

function tip(msg,myEvent)
{
// check for IE4+ DOM and W3C DOM
scope = document.all? document.all.message : document.getElementById("message");

scope.innerHTML="<font color=#FFFFFF size=2 face=arial>"+msg+"</font>";

// check for IE4+ DOM and W3C DOM
twnd= document.all? document.all.tip : document.getElementById("tip");
twnd.style.visibility="visible";
twnd.style.top=myEvent.clientY+19;
twnd.style.left=myEvent.clientX-2;
}

function hide(){
twnd= document.all? document.all.tip : document.getElementById("tip");
twnd.style.visibility="hidden";
}

</script>
<body onClick="tip('Hello',event)" onMouseMove="hide()">
</body>
</html>
ElectricSheep is offline
View Public Profile
 
Old 10-15-2004, 03:35 PM
labintador's Avatar
Skilled Talker

Posts: 96
Trades: 0
Wow thnks bro, try the code later ill post if it workd .
labintador is offline
View Public Profile
 
Old 10-16-2004, 03:10 PM
labintador's Avatar
Skilled Talker

Posts: 96
Trades: 0
It worked!!!


just wondering is there a way which i can use the event variable without passing it to tip function?
labintador is offline
View Public Profile
 
Old 01-24-2007, 12:14 AM Re: Mouse events in firefox, javascript
Average Talker

Posts: 28
Name: dinesh s
Trades: 0
hi frnds,
sorry
dinesh s is offline
View Public Profile
 
Old 01-24-2007, 12:15 AM Re: Mouse events in firefox, javascript
Average Talker

Posts: 28
Name: dinesh s
Trades: 0
hi frnds,
sorry for my english. plz forgive me.
ok, how to find which mouse button is clicked (in firefox).
plz reply soon ...
dinesh s is offline
View Public Profile
 
Closed Thread     « Reply to Mouse events in firefox, javascript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31528 seconds with 12 queries