|
|
To bold text using execCommand - Javascript
|
Views : 1826
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
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 |
|
|
|