exec command - editor (javascript)

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

Hi,
I want to create something that phpBB uses. In jscript im creating a function with an exec command.

Code: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="javascript">
 function doBold()
 {
    news.document.execCommand('bold', false, null);
 }
</script>
<body>
<form name="news_f" id="news_f" action="post">
<input type="button" id="bold_text" name="bold_text" onclick="doBold()" value="B">
<textarea id="news" name="news"></textarea>
</form>
</body>
</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Untitled Document</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. </head>
  7. <script language="javascript">
  8.  function doBold()
  9.  {
  10.     news.document.execCommand('bold', false, null);
  11.  }
  12. </script>
  13. <body>
  14. <form name="news_f" id="news_f" action="post">
  15. <input type="button" id="bold_text" name="bold_text" onclick="doBold()" value="B">
  16. <textarea id="news" name="news"></textarea>
  17. </form>
  18. </body>
  19. </html>


This is all my code. however it does not work.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • isthistakenyet?
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48
  • Loc: Burnley U.K.

Post 3+ Months Ago

You need to put your script inside your head like below
Code: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="javascript">
 function doBold()
 {
  news.document.execCommand('bold', false, null);
 }
</script>

</head>

<body>

<form name="news_f" id="news_f" action="post">
<input type="button" id="bold_text" name="bold_text" onclick="doBold()" value="B">
<textarea id="news" name="news"></textarea>
</form>

</body>

</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Untitled Document</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <script language="javascript">
  7.  function doBold()
  8.  {
  9.   news.document.execCommand('bold', false, null);
  10.  }
  11. </script>
  12. </head>
  13. <body>
  14. <form name="news_f" id="news_f" action="post">
  15. <input type="button" id="bold_text" name="bold_text" onclick="doBold()" value="B">
  16. <textarea id="news" name="news"></textarea>
  17. </form>
  18. </body>
  19. </html>
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

hm still dont work.
  • Hacker007
  • Proficient
  • Proficient
  • User avatar
  • Posts: 371
  • Loc: Riverside, CA

Post 3+ Months Ago

news.document.execCommand?

Shouldnt it be "document.news.execCommand" ?

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 34 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.