Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Need help with WYSIWYG (execCommand)
Old 01-09-2008, 10:44 AM Need help with WYSIWYG (execCommand)
Extreme Talker

Posts: 214
Trades: 0
Hello,

I need to change the default style of my WYSIWYG. How do I do it? I am using execCommand for my WYSIWYG.

See:

The upper is the editor and the lower one is how it looks in the website. In the lower (website) it looks how it should be, all colors and so on, but in the editor it is using default Times New Roman or Arial or something as a font and default black color. I would like to apply the same styles.css of my website to this WYSIWYG editor.

This is my main WYSIWYG code:
Code:
<script language="JavaScript">
var Editor;

function Format(action)
 {Editor.execCommand(action, false, null);}
function Colour(colour)
 {Editor.execCommand("forecolor", false, colour);}
function Font(fontname)
 {Editor.execCommand("fontname", false, fontname);}
function InsertHTML(html)
 {Editor.execCommand("inserthtml",false,html);}

window.onload = function()
 {
  Editor = document.getElementById('textbox').contentWindow.document;
  Editor.designMode = "on";
  Editor.body.innerHTML = '$p_text';
  document.forms[0].onsubmit = function()
   {
    var text = document.getElementById('text');
    text.value = Editor.body.innerHTML;
   }
 }
</script>
Please any help is appreciated!
kaisellgren is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-14-2008, 03:52 PM Re: Need help with WYSIWYG (execCommand)
itHighway's Avatar
Skilled Talker

Posts: 83
Name: Zeeshan Dar
Location: GUJ
Trades: 0
In all web editors default values are defined in its javascript source code. The easiest way to find the default code is to search in javascript file.

For example Innova editor font family is defined in following way:

var Font-Family = "[Arial],[Times],[Tahoma]... ";

First one i.e Arial is the default font. I simply change Arial to Time New Roman to change the default font.
__________________
Zeeshan Dar
itHighway -
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
itHighway is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need help with WYSIWYG (execCommand)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40336 seconds with 12 queries