From: DL on 15 Feb 2010 16:56 Hi, Say, I'm thinking of providing efficiency in using Style for some text for my users with short cut. Where I'm at now, function doRichText(aName,aArg) { getIFrameDocument('textbox1').execCommand(aName,false,aArg); // getIFrameDocument function here ..... trigger, i.e., onclick="doRichText('bold')" Now, what I'd like to move a step further up, is, how to support, say, Alt + B or Ctrl +B, to allow a user to start typing in Bold and then Alt + B or Ctrl + B again to shut it off (exit)? It looks like it has something to do with keypress and keycode something, care to elaborate? Many thanks.
From: Thomas 'PointedEars' Lahn on 15 Feb 2010 18:55 DL wrote: > Now, what I'd like to move a step further up, is, how to support, say, > Alt + B or Ctrl +B, to allow a user to start typing in Bold and then > Alt + B or Ctrl + B again to shut it off (exit)? > > It looks like it has something to do with keypress and keycode > something, care to elaborate? No, RTFM and STFW, we have discussed this ad nauseam (especially recently). However, the best way to achieve that is to use the `accesskey' attribute of the controls that trigger the editor's functions, because then it is less likely that the editor's shortcuts will interfere with the shortcuts of the rest of the GUI. PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann
From: DL on 15 Feb 2010 22:18 On Feb 15, 6:55 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > DL wrote: > > Now, what I'd like to move a step further up, is, how to support, say, > > Alt + B or Ctrl +B, to allow a user to start typing in Bold and then > > Alt + B or Ctrl + B again to shut it off (exit)? > > > It looks like it has something to do with keypress and keycode > > something, care to elaborate? > > No, RTFM and STFW, we have discussed this ad nauseam (especially recently). > > However, the best way to achieve that is to use the `accesskey' attribute of > the controls that trigger the editor's functions, because then it is less > likely that the editor's shortcuts will interfere with the shortcuts of the > rest of the GUI. > > PointedEars > -- > realism: HTML 4.01 Strict > evangelism: XHTML 1.0 Strict > madness: XHTML 1.1 as application/xhtml+xml > -- Bjoern Hoehrmann ok, thanks, the following code not working (no effect), <input type="button" accesskey="B" onclick="var c = frames['textInput'].document.selection.createRange();c.execCommand('Bold',false, 'Yellow');c.select();" /> tested with IE7 on an XP box, what's wrong? Or how to use it correctly in such a situation?
From: DL on 15 Feb 2010 22:33 On Feb 15, 10:18 pm, DL <tatata9...(a)gmail.com> wrote: > On Feb 15, 6:55 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> > wrote: > > > > > DL wrote: > > > Now, what I'd like to move a step further up, is, how to support, say, > > > Alt + B or Ctrl +B, to allow a user to start typing in Bold and then > > > Alt + B or Ctrl + B again to shut it off (exit)? > > > > It looks like it has something to do with keypress and keycode > > > something, care to elaborate? > > > No, RTFM and STFW, we have discussed this ad nauseam (especially recently). > > > However, the best way to achieve that is to use the `accesskey' attribute of > > the controls that trigger the editor's functions, because then it is less > > likely that the editor's shortcuts will interfere with the shortcuts of the > > rest of the GUI. > > > PointedEars > > -- > > realism: HTML 4.01 Strict > > evangelism: XHTML 1.0 Strict > > madness: XHTML 1.1 as application/xhtml+xml > > -- Bjoern Hoehrmann > > ok, thanks, the following code not working (no effect), > > <input type="button" accesskey="B" onclick="var c = > frames['textInput'].document.selection.createRange();c.execCommand('Bold',false, > 'Yellow');c.select();" /> > > tested with IE7 on an XP box, what's wrong? Or how to use it > correctly in such a situation? Update. On that XP box, it's Ctrl + B (working now), not Alt + B. Thank you.
|
Pages: 1 Prev: how does recaptcha get around XSS protection? Next: stop form submit |