taith Posted May 10, 2007 Share Posted May 10, 2007 the disable works perfectly... however the reenableing on select tags, doesnt any ideas? function disablemouse(){ var target=document.body; target.onselectstart=function(){return false} target.onmousedown=function(){return false} } function enablemouse(){ this.onselectstart=function(){return true;} this.onmousedown=function(){return true;} } Quote Link to comment Share on other sites More sharing options...
fenway Posted May 10, 2007 Share Posted May 10, 2007 Strange... You sure you have the right (this)? Quote Link to comment Share on other sites More sharing options...
taith Posted May 11, 2007 Author Share Posted May 11, 2007 yup... <div onfocus="javascript:enablemouse();"></div> Quote Link to comment Share on other sites More sharing options...
fenway Posted May 11, 2007 Share Posted May 11, 2007 Maybe they're not selectable in that sense (though that wouldn't explain how the disabled worked)... how ironic would that be. Quote Link to comment Share on other sites More sharing options...
taith Posted May 11, 2007 Author Share Posted May 11, 2007 i want to be able to disable the highlighting of text everywhere, which works... i also want to be able to activate certain tags... in that example... the div... any other ideas how i could do this? Quote Link to comment Share on other sites More sharing options...
taith Posted May 12, 2007 Author Share Posted May 12, 2007 this still doesnt work... its not giving me any errors, so it is "working"... just not as its supposed to... :-( <s cript> function disablemouse(){ document.body.onselectstart=function(){return false;} document.body.onmousedown=function(){return false;} document.body.style.MozUserSelect="none"; } function enablemouse(loc){ loc.onselectstart=function(){return true;} loc.onmousedown=function(){return true;} return true; } window.onload=disablemouse; </s cript> <span onmouseover="javascript:enablemouse(this);">i dont work either</span> Quote Link to comment Share on other sites More sharing options...
emehrkay Posted May 12, 2007 Share Posted May 12, 2007 is onselectstart a js event?  http://www.w3schools.com/jsref/jsref_events.asp  try onclick or focus Quote Link to comment Share on other sites More sharing options...
taith Posted May 15, 2007 Author Share Posted May 15, 2007 no change... and yes... its for netscape... Quote Link to comment Share on other sites More sharing options...
mainewoods Posted May 18, 2007 Share Posted May 18, 2007 don't know if this will work in your circumstances, but try saving the event vectors before you mod them, and then restore the saved vectors. var saveonselect = document.body.onselectstart; var saveonmousedown = document.body.onmousedown; function disablemouse(){ var target=document.body; target.onselectstart=function(){return false} target.onmousedown=function(){return false} } function enablemouse(){ this.onselectstart = saveonselect; this.onmousedown = saveonmousedown; } Quote Link to comment Share on other sites More sharing options...
taith Posted May 19, 2007 Author Share Posted May 19, 2007 YAY! it works! sorta.... now... i'm no js expert... but this only works once... ??? ??? ???  <s cript> var saveonselect = document.body.onselectstart; var saveonmousedown = document.body.onmousedown; function disablemouse(){ var target=document.body; target.onselectstart=function(){return false} target.onmousedown=function(){return false} } function enablemouse(){ this.onselectstart = saveonselect; this.onmousedown = saveonmousedown; } window.onload=disablemouse; </s cript> <span onmouseover="javascript:enablemouse();" onmouseout="javascript:disablemouse();">text</span> test  i mouseover the span, it allows me to highlight, mouseout, i cant highlight, i mouseover, i still cant highlight... ??? Quote Link to comment Share on other sites More sharing options...
taith Posted May 19, 2007 Author Share Posted May 19, 2007 scratch that... still doesnt work... doesnt enable anything ever... Â <sc ript> var saveonselect=document.body.onselectstart; var saveonmousedown=document.body.onmousedown; function disablemouse(){ document.body.onselectstart=function(){return false;} document.body.onmousedown=function(){return false;} } function enablemouse(){ document.body.onselectstart=saveonselect; document.body.onmousedown=saveonmousedown; } </sc ript> <body onload="javascript:disablemouse();"> <span onfocus="javascript:enablemouse();" onmouseout="javascript:disablemouse();">text</span>test Quote Link to comment Share on other sites More sharing options...
mainewoods Posted May 19, 2007 Share Posted May 19, 2007 try changing the order of the 2 statements: function enablemouse(){ document.body.onselectstart=saveonselect; document.body.onmousedown=saveonmousedown; } I'm not sure of onfocus support with span, and how do you get focus if the mouse is disabled? Try onmouseover with an input instead: <body onload="javascript:disablemouse();"> <form name="test"> <input onmouseover="enablemouse();" onmouseout="disablemouse();" value="you can select me" name="test1"> <input value="you cant select me" name="test2"> </form> Quote Link to comment Share on other sites More sharing options...
taith Posted May 22, 2007 Author Share Posted May 22, 2007 lol it doesnt disable the whole mouse... it only disables the highlighting of the text... so when you put your mouse over a span/div/table or wherelse i put it, it gives access... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.