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;} } Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/ 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)? Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-250021 Share on other sites More sharing options...
taith Posted May 11, 2007 Author Share Posted May 11, 2007 yup... <div onfocus="javascript:enablemouse();"></div> Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-250222 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. Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-250630 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? Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-250652 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> Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-251445 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 Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-251491 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... Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-253419 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; } Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-256542 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... ??? Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-256887 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 Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-256966 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> Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-257188 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... Link to comment https://forums.phpfreaks.com/topic/50826-disenable-mouses-select/#findComment-258935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.