To bold text using execCommand - Javascript Views : 1826
Tagged in : Javascript
1 0
Send mail
Hi...
If you want to bold the particular text use the below code

<html>
<head>
<title> Using execCommand to bold text </title>
<script type="text/javascript">
function Init()
{
var edit = document.getElementById("iView").contentWindow.document;
edit.designMode = "On" ;
}
function boldIt()
{
var edit = document.getElementById("iView").contentWindow;
edit.focus();
edit.document.execCommand("bold", false, "");
edit.focus();
}
</script>
<body onLoad="Init()">
<iframe id="iView" style="width: 200px; height:70px"></iframe>
<input type="button" onClick="boldIt()" value="Bold Text">
</body>
</html>
By Nirmala, On - 2009-04-20



    Login to add Comments .