[Javascript] disableselect in firefox
Troy III Ajnej
trojani2000 at hotmail.com
Thu Mar 2 18:50:07 CST 2006
This is a repost, since my original post is still cycling on servers, not
being delivered for about an hour now.
Thanks for your repllies.
I'm sending my source code for IE somewhat modified for FX, but it doesn't
work in it. One of the problems is that I'm not geting any error report in
JavaScript Console with this version of code.
Is it possible to make this code happen in FX as it does in IE?
html
head
style
IMG { height: 45px; border: 2px ridge #444499; background: white;
text-align: center; margin:1px}
#display { width:204; color: #7B8EBD; text-indent: 6; font: bold 8pt arial;
border: 2px solid #222233; background: black; text-align: center;
margin:1px}
#BASE { border-style:ridge; border-color:#63659C; width:200; height:150;
text-align: center; margin:1px}
INPUT,BUTTON { width: 98px; font: bold 8pt arial; text-align: center;
margin:1px}
#navigator { position: absolute; Top: 120px; Left: 10px; width:230px;
height:460px; text-align: center;margin:1px}
#navcapt { background: #202020; cursor: default; color: white; border: 1px
outset white; font:bold 8pt Arial; text-align: center; margin:1px}
#navbody { display:block; text-align: center;margin:1px}
/style
/head
<body style="color: #52B6DE; width: 100%; background: #0A0A0F">
<!--NAVIGATOR START-->
<DIV id="navigator">
<FIELDSET>
<LEGEND id="navcapt">  NAVIGATOR  </LEGEND>
<DIV id='navbody'>
<BUTTON id="load" Accesskey="L"><u>L</u>OAD </BUTTON><BUTTON id="galery"
Accesskey="G"><u>G</u>ALLERY</BUTTON><br />
<IMG ID="BASE" SRC="LOGO.JPG" width="200" height="150" /><br />
<BUTTON id="show" Accesskey="H"><u>H</u>IGH RES</BUTTON><BUTTON
id="save" Accesskey="S"><u>S</u>AVE</BUTTON><br />
<BUTTON id="moveleft"Accesskey=","><u><</u> MOVE </BUTTON><BUTTON
id="moveright" Accesskey="."> MOVE <u>></u></BUTTON>
</DIV>
<DIV ID="display">monitor</DIV>
</FIELDSET>
</DIV>
<!--NAVIGATOR END-->
/body
script
var dx, dy, mobile='false', dragged='false'
// vars added for W3C element refference compliance!
var navigator=document.getElementById("navigator")
var navcapt=document.getElementById("navcapt")
var nv=document.getElementById("navbody")
function expandcolapse(){
if(dragged=='false'){
if(nv.style.display!="none"){nv.style.display='none'}else{nv.style.display='block'}
}
}
function enablemove(event){ if(!event) event = window.event //suppressing
'event not defined' in firefox
mobile='true';
dragged='false'; //revive toggle navigator
dx=event.screenX-navigator.offsetLeft // (a-b) always >= 0
dy=event.screenY-navigator.offsetTop
}
function disablemove(){mobile='false'}
function mousefollower(event){ if(!event) event = window.event //suppressing
'event not defined' in firefox
if(mobile=='true'){
navigator.style.posLeft= (event.screenX-dx) // IE supports "event.x"
over "event.clientX" and "screenX" also.
navigator.style.posTop = (event.screenY-dy) }
}
function canceldefault(){dragged='true'; return false}
navigator.onmousedown=enablemove
document.onmousemove=mousefollower //prevent mouse escaping from draged-el
navigator.onmouseup=disablemove
navigator.onselectstart=canceldefault //disable select
navigator.ondragstart = canceldefault //disable image drag
navcapt.onclick = expandcolapse
/script
/html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Troy III
progressive art enterprise
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
More information about the Javascript
mailing list