SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: wysiwyg problem
-
Jun 10, 2007, 02:23 #1
- Join Date
- Dec 2005
- Posts
- 527
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
wysiwyg problem
hello this code can work :
Code:<html> <head> <title> Using execCommand to bold text </title> <script language="JavaScript"> function Init() { iView.document.designMode = 'On'; } function boldIt() { iView.document.execCommand('bold', false, null); } </script> <body > <iframe id="iView" style="width: 200px; height:70px"></iframe> <br><br> <input type="button" onClick="boldIt()" value="Toggle Bold"> <input type="submit" onclick="Init()"> </body> </html>
Code:<html> <head> <title> Using execCommand to bold text </title> <script language="JavaScript"> function Init(objec) { objec.document.designMode = 'On'; } function boldIt() { iView.document.execCommand('bold', false, null); } </script> <body > <iframe id="iView" style="width: 200px; height:70px"></iframe> <br><br> <input type="button" onClick="boldIt()" value="Toggle Bold"> <input type="submit" onclick="Init('iView')"> </body> </html>
The buttom code can not work in IE 6 SP2
What should I do ?
-
Jun 10, 2007, 03:43 #2
- Join Date
- Jan 2007
- Location
- Belgium
- Posts
- 591
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code JavaScript:function Init(objec) { document.getElementById(objec).document.designMode = 'On'; }
FOR SALE: 1 set of morals, never used, will sell cheap
-
Jun 10, 2007, 04:50 #3
- Join Date
- Dec 2005
- Posts
- 527
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i test it but can not work :
Code:document.getElementById('text1').document.designMode = 'On'; document.getElementById(objec).document.designMode = 'On';
Code:text1.document.designMode = 'On';
-
Jun 10, 2007, 05:18 #4
- Join Date
- Jan 2007
- Location
- Belgium
- Posts
- 591
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
And using window.frames[0]?
FOR SALE: 1 set of morals, never used, will sell cheap
-
Jun 10, 2007, 06:30 #5
- Join Date
- Dec 2005
- Posts
- 527
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Do you mean ?
Code:window.frames[0].getElementById(objec).document.designMode = 'On' ?
-
Jun 10, 2007, 16:10 #6
- Join Date
- Jan 2007
- Location
- Belgium
- Posts
- 591
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't know if this would work, I'm just thinking along.
But how about something like this?
Code JavaScript:function Init(id) { var obj = document.getElementById(id); if(obj.document && obj.document.designMode) { obj.document.designMode = "On"; } else if(frames && frames.obj && frames.obj.document.designMode) { frames.obj.document.designMode = "on"; } else if (obj.contentDocument) { obj.contentDocument.designMode = "on"; } else { alert('Not supported'); } }
FOR SALE: 1 set of morals, never used, will sell cheap
-
Jun 10, 2007, 23:50 #7
- Join Date
- Dec 2005
- Posts
- 527
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No it can not awnser yet
Is my code complete?
Code:<textarea id="text1"></textarea> <script language="javascript"> function Init(id) { var obj = document.getElementById(id); if(obj.document && obj.document.designMode) { obj.document.designMode = "On"; } else if(frames && frames.obj && frames.obj.document.designMode) { frames.obj.document.designMode = "on"; } else if (obj.contentDocument) { obj.contentDocument.designMode = "on"; } else { alert('Not supported'); }} Init('text1'); </script>
-
Jun 11, 2007, 01:20 #8
- Join Date
- Jan 2007
- Location
- Belgium
- Posts
- 591
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I can't seem to get this right, apparantly.
Have you read the docs?
Internet Explorer - designMode Property (document)
Mozilla Firefox - Midas SpecificationFOR SALE: 1 set of morals, never used, will sell cheap
Bookmarks