473,770 Members | 4,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.pasteHTM L(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.virtualcott ageindustries.c om/webpageRecordEd itor.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 2717
On Mon, 19 Apr 2004 18:24:42 GMT, Simon Wigzell <si**********@s haw.ca>
wrote:

[snip]
sRange.pasteHTM L(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.virtualcott ageindustries.c om/webpageRecordEd itor.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.******@blueyo nder.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**********@s haw.ca> wrote in message
news:KPUgc.1803 34$Ig.17392@pd7 tw2no...
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.pasteHTM L(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.virtualcott ageindustries.c om/webpageRecordEd itor.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**********@s haw.ca> wrote in message
news:KPUgc.1803 34$Ig.17392@pd7 tw2no...
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.pasteHTM L(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.virtualcott ageindustries.c om/webpageRecordEd itor.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
6843
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 the the span element when I select the whole text in the SPAN and drag it. However, I want to drag it without have to select the words between the span element. The default mouse action will only select the words when i move the mouse. Can...
2
1971
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 class=placeHolder>]</BUTTON>&nbsp;text</STRONG>" the HTML is pasted properly and the UI is changed accordingly.
10
4104
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 class=placeHolder>]</BUTTON>&nbsp;text</STRONG>" the HTML is pasted properly and the UI is changed accordingly.
9
2958
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 text in the file. We've been trying to use the RichTextBox control to load
2
1255
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 range() is a textRange, so what does the t && mean? I'm having a hard time figuring out how the range() function works. I know it returns a textRange, but I'd like to understand how it works. function c_table( e, v ) { var t =...
5
3885
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 an intermittent problem working with editing Hyperlinks. As you can see the following HTML code contains two links each in a paragraph tag. In the Editor, when I highlight the first link and execute code to select,
4
2106
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, if I don't specifically click into the iFrame (it is in design mode) then when I paste the HTML it attaches itself to the main document rather than in the iframe 'body'.
1
2136
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
3724
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 is the code: <html> <script> function Test() {
0
9602
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9439
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7431
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.