Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: execCommand()


Message #1 by "Edwin López" <edwin@m...> on Sun, 27 Jan 2002 08:39:35
--part1_a6.204f72be.29874b7e_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

here is a little example code you might find helpful i did 
i will send several codes 
strTextPowerText is just the text area in my program
you can take it out or replace it....

:1:
<SCRIPT>
function SaveGraph()
{    //this code dose the saveas window will not work in .hta mode
strTextPowerText.document.execCommand('SaveAs')
return false;
}
</SCRIPT>

:2:
//this code i use alot were it says redo you can add many commands here are a 
few
<redo>
<undo>
<clearall>
<selcetall>
<copy>
<past>
<cut>
onClick="strTextPowerText.document.execCommand('redo','','');strTextPowerText.

focus();">redo </a>

:3:
//to do font sizes you will need to do something a little diferent
//were that 7 is you can type  1 - 7
onClick="strTextPowerText.document.execCommand('fontsize','','7');strTextPower

Text.focus();">font-36</a>

:4:
//to do font edits were the bold is you can add
<Italic>
<Underline
<StrikeShrough>
<SubScript>
<SuperScript>
onClick="strTextPowerText.document.execCommand('bold','','');strTextPowerText.

focus();"> bold </a>

:5:
//this is just other few things
onClick="strTextPowerText.document.execCommand('insertimage','',prompt('Image 
URL'));strTextPowerText.document.execCommand('fontsize','','2');strTextPowerTe

xt.focus();"> add a piture </a>

 
onClick="strTextPowerText.document.execCommand('createLink','',prompt('Please 
enter your URL to link to'));strTextPowerText.focus();"> add a link </a> 

:6:
//and these are just a few other examples were outdent is you can add
<indent>
<justifyright>
<justifyleft>
<justifycenter>
<insertunorderedlist>
<insertorderedlist>
onClick="strTextPowerText.document.execCommand('outdent','','');strTextPowerTe

xt.focus();"> outdent </a>


hope these examples help you get done what you want to get done

**TRUE**




  Return to Index