• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 546
  • Last Modified:

execCommand.

Hi all,

I have tried out a code i read from www.devarticles.com using execCommand to enable users to bold a certain text.

A part of it is :

function Init()
{
iView.document.designMode='On';
}

and my body is <body onLoad="Init()">

However, previewing in IE5, there is an error in the body tag.

Im not able to type in the iframe also (even though the designMode is set to 'On'

Is there something that I miss here?

Hope someone can help me.
Thank you very much.
0
megmeg
Asked:
megmeg
2 Solutions
 
avnerCommented:
What is iView ?
You'll have to post more code...
0
 
mbochniakCommented:
If iView is the id (id="iView") of the iFrame, then you have the syntax backwards. It should be:

document.iVeiw.designMode='on';

The uppercase in 'On' may also be a problem. I'm not sure, though.
0
 
megmegAuthor Commented:
Avber,ivView is the id for my iFrame.

This is the body ( which has error in the <body onLoad="Init()"> )

<body onLoad="Init()">
<iframe id="iView" width="200" height="70"></iframe>
<br><br>

<input type="button" onClick="boldIt()" value="Toggle Bold">
</body>

This is the js function.

<script language=\"JavaScript\">

function Init()
{
iView.document.designMode="On";
}

function boldIt()
{
iView.document.execCommand("bold", "false", "null");
}

</script>

mbochniak, I have tried to change the uppercase to lowercase but its still not working. I think the syntax is correct isnit?

Thank you..

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
megmegAuthor Commented:
hi..

i have solved the problem i guess. It was all my stupidness. After posting the previous comment, I found my error in <script language=\"JavaScript\"> . I shouldnt put a \ in the script.

I was doing some work in php, thats why i had put the \ before it. Once take out, it works.

I think conclusion would be take, the upper and lowercase works fine. and the syntax is ok.

Thanks for the two of you in replying to me.
0
 
megmegAuthor Commented:
hi..

i have solved the problem i guess. It was all my stupidness. After posting the previous comment, I found my error in <script language=\"JavaScript\"> . I shouldnt put a \ in the script.

I was doing some work in php, thats why i had put the \ before it. Once take out, it works.

I think conclusion would be take, the upper and lowercase works fine. and the syntax is ok.

Thanks for the two of you in replying to me.
0
 
megmegAuthor Commented:
hi..

i have solved the problem i guess. It was all my stupidness. After posting the previous comment, I found my error in <script language=\"JavaScript\"> . I shouldnt put a \ in the script.

I was doing some work in php, thats why i had put the \ before it. Once take out, it works.

I think conclusion would be take, the upper and lowercase works fine. and the syntax is ok.

Thanks for the two of you in replying to me.
0
 
jaysolomonCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now