0
// No select for Internet Explorer
this.gContainer.onmousedown = function(evt) {
    noselect;
}

This works great, but throws 'no select unknown' in Chrome/Firefox. I've tried putting try catch block around it, but this stops it functioning.

Any ideas?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
  • Are you using some kind of frameworks? noselect is not a statement. noselect() or something.something='noselect' or you need a function noselect() and then you can use something.someeventhandler=noselect – mplungjan Dec 15 '10 at 10:34
  • No framework, I don't understand why this code works as you say, but it does work for IE! – Tom Gullen Dec 15 '10 at 10:36
  • Where do you get the noselect from - some tutorial? I think the reason it works in IE is that it stops the script and cancels the onmousedown due to the error. Also please explain WHAT you want to happen. Perhaps we have a better alternative – mplungjan Dec 15 '10 at 10:44
  • It's ok I've fixed it now, it's not valid markup, but worked because IE stops the flow when the error is reached. – Tom Gullen Dec 15 '10 at 10:45
  • Tim Down's answer at http://stackoverflow.com/questions/4448671/making-things-unselectable-in-ie works perfectly. – Tom Gullen Dec 15 '10 at 10:46

3 Answers3

1
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

noselect;
  } else
{

 evt.noselect;
}
Pradeep Singh
  • 3,582
  • 3
  • 29
  • 42
1

There is no noselect keyword in IE or FF or any browser.

You must have included some script but even then, the syntax you use to call it is wrong.

It gives errors to my IE. What system/app are you developing for ?

Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317
  • Yeah I can see it's kinda wrong but I've tried a lot of other things and this is the only thing that works. – Tom Gullen Dec 15 '10 at 10:40
  • Ah it must be throwing an error in IE and stopping the process because if I change it to anything it still works guess I'll go back and figure it out properly. – Tom Gullen Dec 15 '10 at 10:42
0

AFIAK, there is "noselect" keyword on IE and/or FF or any browsers. Even if there is I think using noselect; doesn't take any effect, it should have been an assignment or perhaps a function call like noselect=true; or noselect();

if noselect is a function not an attribute this will eliminate the error on any browser:

this.gContainer.onmousedown = function(evt) {
    if(window.noselect) //if noselect is on global or <objectcontext>.noselect if not
        noselect();
}
jerjer
  • 8,694
  • 30
  • 36