How to create / map short-cut to some presentation features?

D

DL

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.
 
T

Thomas 'PointedEars' Lahn

DL said:
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
 
D

DL

No, RTFM and STFW, we have discussed this ad nauseam (especially recently).  

However, the best way to achieve that is to use the `accesskey' attributeof
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?
 
D

DL

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 ofthe
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,575
Members
47,207
Latest member
HelenaCani

Latest Threads

Top