473,408 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

pasteHTML

I'm using a 3rd party (htmlarea) WYSIWYG html editting tool. it works great
most of the time. I have a problem where I've made my own function to create
a bookmark type link. e.g. I want to turn the word "Bottom" into a link to
the bottom of the page where resides a bookmark e.g. <a name="Bottom"></a>

The 3rd party software in it's guts has this command:

sRange.pasteHTML(str1 +sHtml+ str2)

Where str1 = <a href="#Bottom">
sHtml = Bottom
str2 = </a>

sRange is the highltighted text that I want to make a link.

So you would expect it to make a string like this:

<a href="#Bottom">Bottom</a>

However, it makes a string like this :

<A
href="http://www.virtualcottageindustries.com/webpageRecordEditor.asp#Bottom
">Bottom</A>

Where http://www.virtualcottageindustries....cordEditor.asp is the
page that contains the 3rd party WYSIWYG editor. The HTML text I'm creating
here gets saved to a database and then used to generate a web page of a
completely different name. All I want is this : <a href="#Bottom">Bottom</a>

Any ideas?
Jul 23 '05 #1
3 2698
On Mon, 19 Apr 2004 18:24:42 GMT, Simon Wigzell <si**********@shaw.ca>
wrote:

[snip]
sRange.pasteHTML(str1 +sHtml+ str2)

Where str1 = <a href="#Bottom">
sHtml = Bottom
str2 = </a>

sRange is the highltighted text that I want to make a link.

So you would expect it to make a string like this:

<a href="#Bottom">Bottom</a>

However, it makes a string like this :

<A
href="http://www.virtualcottageindustries.com/webpageRecordEditor.asp#Bottom
">Bottom</A>


Are you certain that this is generated by the script, or did you determine
it some other way[1]? Don't forget that "#Bottom" is a relative URL that
will use the current URL[2] to resolve the actual destination. If it does
generate that URL, try including the filename for the page and if that
fails, try an absolute URL.

[snip]

Mike
[1] I don't mean to patronise. I'm just trying to be thorough.
[2] Unless a base URL has been explicitly specified with the BASE element.

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2
I have used HTMLArea to good effect in my own applications. It's a helluva
tool.

According to MSDN re: the pasteHTML method:

<quote>
This method might alter the HTML text to make it fit the given text range.
For example, pasting a table cell into a text range that does not contain a
table might cause the method to insert a table element. For predictable
results, paste only well-formed HTML text that fits within the given text
range.
</quote>

Now, given Microsoft's well-meaning but pita propensity to "help" us by
doing a lot of work for us, we might be able to assume from the paragraph
above that when the browser detects a named link it automatically "helps" by
putting the rest of the url in.

So, question: what happens if you leave out the pound sign? Does it go in
the way you want it to then?
Second question: what happens if you break the string with the pound sign
into more pieces, i.e.: str1 = "< href=""", str2="#", str3="Bottom"">", and
so on.
Barring that, what happens if you put in the string thusly: str1 = "<a
href=""" & chr(35) & "Bottom"">"...
--
William Morris
Semster, Seamlyne reProductions
Visit our website, http://www.seamlyne.com, for the most comfortable
historically inspired clothing you can buy!


"Simon Wigzell" <si**********@shaw.ca> wrote in message
news:KPUgc.180334$Ig.17392@pd7tw2no...
I'm using a 3rd party (htmlarea) WYSIWYG html editting tool. it works great most of the time. I have a problem where I've made my own function to create a bookmark type link. e.g. I want to turn the word "Bottom" into a link to
the bottom of the page where resides a bookmark e.g. <a name="Bottom"></a>

The 3rd party software in it's guts has this command:

sRange.pasteHTML(str1 +sHtml+ str2)

Where str1 = <a href="#Bottom">
sHtml = Bottom
str2 = </a>

sRange is the highltighted text that I want to make a link.

So you would expect it to make a string like this:

<a href="#Bottom">Bottom</a>

However, it makes a string like this :

<A
href="http://www.virtualcottageindustries.com/webpageRecordEditor.asp#Bottom ">Bottom</A>

Where http://www.virtualcottageindustries....cordEditor.asp is the page that contains the 3rd party WYSIWYG editor. The HTML text I'm creating here gets saved to a database and then used to generate a web page of a
completely different name. All I want is this : <a href="#Bottom">Bottom</a>
Any ideas?

Jul 23 '05 #3
Thanks both, I've decided to fix it by using the asp replace function to
remove the offending string.

"Simon Wigzell" <si**********@shaw.ca> wrote in message
news:KPUgc.180334$Ig.17392@pd7tw2no...
I'm using a 3rd party (htmlarea) WYSIWYG html editting tool. it works great most of the time. I have a problem where I've made my own function to create a bookmark type link. e.g. I want to turn the word "Bottom" into a link to
the bottom of the page where resides a bookmark e.g. <a name="Bottom"></a>

The 3rd party software in it's guts has this command:

sRange.pasteHTML(str1 +sHtml+ str2)

Where str1 = <a href="#Bottom">
sHtml = Bottom
str2 = </a>

sRange is the highltighted text that I want to make a link.

So you would expect it to make a string like this:

<a href="#Bottom">Bottom</a>

However, it makes a string like this :

<A
href="http://www.virtualcottageindustries.com/webpageRecordEditor.asp#Bottom ">Bottom</A>

Where http://www.virtualcottageindustries....cordEditor.asp is the page that contains the 3rd party WYSIWYG editor. The HTML text I'm creating here gets saved to a database and then used to generate a web page of a
completely different name. All I want is this : <a href="#Bottom">Bottom</a>
Any ideas?

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Wang, Jay | last post by:
Hello, all, I would like to enable some text between <SPAN url="http://www.testserver.com/">WORD TO BE DRAGGED </SPAN>. I put some javascript and it will extract http://www.testserver.com/ from...
2
by: colinhumber | last post by:
I'm running this line of code: oTarget.pasteHTML(formattedHtmlText); where oTarget is a text range object. When formattedHtmlText is, say, "<STRONG><BUTTON...
10
by: colinhumber | last post by:
I'm running this line of code: oTarget.pasteHTML(formattedHtmlText); where oTarget is a text range object. When formattedHtmlText is, say, "<STRONG><BUTTON...
9
by: Jay Kim | last post by:
Hi, We're implementing a Windows application using Visual Basic .NET. One of the key features we need to implement is that we should be able to get the accurate byte offset of user selected...
2
by: Trevor | last post by:
I'd really appreciate it if someone could please help me understand the code below. The only question I have about c_table() is about the t && range( 1 )... line; what does the t && part mean? The...
5
by: Jason | last post by:
Hi, I'm developing an HTML Editor Control using VB.Net 2003 for an application that used to use the DHTML Editor Control that is no longer supported. Well, it's been fun but I've hit a wall with...
4
by: Laphan | last post by:
Hi The god that is Martin Honnen gave me a great tip to DOM/JS some HTML data into an iframe, but I need to make sure that the iframe is ready to take it before I paste it in. At the moment,...
1
by: geevaa | last post by:
Hi All, Try the example javascript given in this link in IE and Firefox. http://www.java2s.com/Code/JavaScript/Node-Operation/pasteHTMLExample.htm <html> <body>
16
by: markjavascript | last post by:
Hi, In an editable div, I inserted a big letter, Rng.pasteHTML("<font size=5>A</font>");,fine. However, after that, when type in other letters, (sometimes) I got big letters with size=5. Here...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.