Sending HTML only on Submit.

This is a discussion on "Sending HTML only on Submit." within the JavaScript Forum section. This forum, and the thread "Sending HTML only on Submit. are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1  
Old Oct 18th, 2004, 03:35
Reputable Member
Join Date: Sep 2004
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Sending HTML only on Submit.

Here's my question. Let's say I build an editor based on the Idea of Monie and Spinal.
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />I'm not good at these things but i'll explain monie's code...

THE IDEA:
the textRange object lets you rerieve and change text within an element.

USES:
"document.selection" points to the current selection on the document (duh!)

I made a small example so you can try it out yourself.
save this onto a htm file and run it:

<SCRIPT>
function MakeBold(){
// find selection
r = document.selection.createRange();

// exit function if no selection has been made
if(r==null){ return; }

// replace selection by itself, surrounded by the "[b]" tag
r.pasteHTML("" +r.htmlText+ "");
}
</SCRIPT>
<INPUT TYPE=button value="Make Selection Bold" onMouseDown="MakeBold();">


text and more text and more text and more text and more text and more
text and more text and more text and more text and more text and more
text and more text and more text and more text and more text and more
text and more text and more text and more text and more text and more
text and more text and more text and more text and more text and more
text and more text and more text and more text and more text and more
</BODY>


1 . make a selection
2 . click the "Make Selection Bold" button
3 . that will trigger a function wi=hich will:
3 a) find the selection in the body of the document
3 b) retrieve the selected text
3 c) replace it by the same selected text sorrounded by the "[b]" tag
<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote">

How would I go about making it where when the user clicked on "Submit" it sends the HTML only and not the script? I think if I can get this to work it would be great for my users who don't understand anything about HTML.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Oct 19th, 2004, 11:22
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,668
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
simple,

once you've updated the textRange's html to show the result of the operation, use the same textRange to retrive the HTML code and save the it onto a hidden textarea, then submit the textarea...

i dont have time now but I'll write an example later...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Oct 19th, 2004, 16:12
Anonymous User
Guest
Posts: n/a
I would not advice you designing your own HTML editor for the following reasons:

1. there's free stuff out there. many very talented programmers (God bless the bastards) spend months or even years developing the most sweet pieces of coding you ever seen and let you use at at will. I gave up my own editor when I found htmlArea (http://www.interactivetools.com/products/htmlarea/)

2. having made the point above, you'll be wasiting your time trying to design something that will match the quality of the above, so unless you're simply trying to learn a few techniques, don't go all the way. by all means try and re-create the software in your own way, practice and learn from the code, but anyone is better off taking advantage of the free software available.

3. I forgot wat my third point was...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Oct 19th, 2004, 16:15
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,668
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
dat was me ^^^^
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Oct 19th, 2004, 18:28
Rob's Avatar
Rob Rob is online now
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,159
Blog Entries: 7
Thanks: 27
Thanked 19 Times in 16 Posts
[img]images/spinalbrain.gif[/img]
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Oct 19th, 2004, 18:38
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,668
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
OOOOOOOOOOOOOOHHHHHHHHHHHHHHHH....................
THAT'S GETTING PERSONAL....


but I like it! nice chart!
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Oct 19th, 2004, 18:52
Rob's Avatar
Rob Rob is online now
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,159
Blog Entries: 7
Thanks: 27
Thanked 19 Times in 16 Posts
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Oct 19th, 2004, 19:57
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
I think Rob has WAAAY too much time on his hands!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old Oct 19th, 2004, 19:58
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
i agree!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
Old Oct 20th, 2004, 08:40
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,668
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
yeah, me too!

I;d never do have anytime to aste on that....
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #11  
Old Oct 20th, 2004, 09:09
Rob's Avatar
Rob Rob is online now
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,159
Blog Entries: 7
Thanks: 27
Thanked 19 Times in 16 Posts
I took me 3 minutes.... lol
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
sending, html, submit

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Html button sending data to flash movie..how??? webworks Flash & Multimedia Forum 2 Sep 23rd, 2007 16:13
Need help sending HTML message in PHP. annawilsonz PHP Forum 0 Sep 14th, 2007 06:31
submit many forms - auto submit the same form many times divs JavaScript Forum 0 May 24th, 2007 10:10
HTML forms (format after submit) dannozza Web Page Design 1 May 11th, 2007 14:35
problem with images when sending html page by mail juanb007 Web Page Design 4 Apr 29th, 2007 03:25


All times are GMT. The time now is 19:25.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42