wjdashwood
asked on
onFocus? indented when clicked on bold text in textarea, not when text is not bold
Hi, me again!
I have some code which makes highlighted text in a rich text box bold or unbold.
At the moment I have an image which onmouseover is indented and onmouseout is normal.
What I want is the code to see where the cursor is in the textbox (what place in the text it is clicked) and see whether it is bold or not. if it is then I want the image sbold and if it isn't then I want the image bold to be shown.
I believe it may be something to do with onfocus but my attempts have not worked.
Can anyone point me in the right direction, I'v been looking at other code but I can't distiguish which bit of code does this.
The code I already have is as follows:
<html>
<head>
<script>
function FormatText(command, option) {
document.getElementById("e dit").cont entWindow. focus();
document.getElementById("e dit").cont entWindow. document.e xecCommand (command, false, option);
document.getElementById("e dit").cont entWindow. focus();
}
</script>
</head>
<body scroll=no onLoad='frames.edit.docume nt.designM ode = "On"'; rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<a href="javascript:" onClick="FormatText('bold' ,'')" onmouseover="bold.src='ima ges/button s/sbold.gi f'" onmouseout="bold.src='imag es/buttons /bold.gif' "><img name="bold" border=0 src="images/buttons/bold.g if"> Make text bold</a>
<iframe id="edit" width="100%" height="57%"></iframe>
</body>
</html>
Thanks
I have some code which makes highlighted text in a rich text box bold or unbold.
At the moment I have an image which onmouseover is indented and onmouseout is normal.
What I want is the code to see where the cursor is in the textbox (what place in the text it is clicked) and see whether it is bold or not. if it is then I want the image sbold and if it isn't then I want the image bold to be shown.
I believe it may be something to do with onfocus but my attempts have not worked.
Can anyone point me in the right direction, I'v been looking at other code but I can't distiguish which bit of code does this.
The code I already have is as follows:
<html>
<head>
<script>
function FormatText(command, option) {
document.getElementById("e
document.getElementById("e
document.getElementById("e
}
</script>
</head>
<body scroll=no onLoad='frames.edit.docume
<a href="javascript:" onClick="FormatText('bold'
<iframe id="edit" width="100%" height="57%"></iframe>
</body>
</html>
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks, that seems to do what I wanted. A little more complicated than I hoped it would be but nevermind. I'll just have to work a little harder to get my head around it.
Thank you.
Thank you.
http://richtext.cs.ramesys.com/rt-0.3/help/samples/test_embedded.asp