View Full Version : Think You're good at Java? Heres a Challenge(calling all geniuses)

05-27-2004, 04:54 PM
Arlight friends, since you guys are so amazing at Javascripting I have a question for you. Because I need help. I've set up a system for submitting news etc and I have to interact with a database and so im using net.data code. Thats unimportant though. When The user is submitting news I am pretty much using forms. I want to make it so that when a user is typing in the form they have the option to highlight the text and click a button which will then add tags before and after the text. For example if my phrase were "the silly bunny". They would highlight it and click on bold and then in the form it would look like this :
<b>the silly bunny</b> I need to make it this way so that the HTML code goes into the database. My problem is just that I dont know if its possible to do what I need, having tags go infrotn and after when you click on a button(java). This would be great if I could get some help on this! Thanks!

05-27-2004, 05:09 PM
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html (Range interface for Mozilla)
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_textrange.asp (TextRange object for IE)

Hope that helps!

Happy coding! :)

05-27-2004, 05:09 PM

You call it a challenge? Try again :cool: :D :D

One note. You do not want to insert HTML directly for security reasons. Use pseudo-tags as this forum does and process them on the server.

05-27-2004, 05:11 PM
I could cry :)