Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > preserving html tags in a selection w/Safari

Thread Tools

preserving html tags in a selection w/Safari

Posts: n/a
I'm trying to teach myself a little javascript on the mac, and in the
course of doing so, I decided to try to create a bookmarklet to open a
selected area of text in a new window (Using Safari 1.0.1). This is
easy enough to accomplish, but I'd like to preserve the html markup
of the selected text. To my knowledge, createRange() doesn't work with
Safari, and I can't think of a way to do it. Here's what I have;

javascriptutText=getSelection();if(!outText){voi d(0)};if(outText){'','select ionWindow','width=800,height=600');newwindow.docum ent.write('<body>'+outText+'</body>');newwindow.document.close()}

Is there a means of replacing getSelection() with something that will
preserve the html tags within the selection??

Thanks in advance!
Reply With Quote

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 Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sign preserving Vs value preserving C Programming 4 12-07-2007 03:14 PM
All style tags after the first 30 style tags on an HTML page are not applied in Internet Explorer Rob Nicholson ASP .Net 3 05-28-2005 03:11 PM
integral promotion, arithmetic conversion, value preserving, unsigned preserving??? TTroy C Programming 16 01-31-2005 10:20 PM
XSLT:Preserving HTML tags from original XML. Joe XML 2 09-21-2004 01:30 AM
RegEx to find CFML tags nested in HTML tags Dean H. Saxe Perl 0 01-03-2004 06:11 PM