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

Home Posts Topics Members FAQ

pasteHTML not working properly

I'm running this line of code:

oTarget.pasteHT ML(formattedHtm lText);

where oTarget is a text range object.

When formattedHtmlTe xt is, say, "<STRONG><BUTTO N
class=placeHold er>[[ContAmt]]</BUTTON>&nbsp;te xt</STRONG>" the HTML is
pasted properly and the UI is changed accordingly.

However, if formattedHtmlTe xt is "<BUTTON
class=placeHold er>[[ContAmt]]</BUTTON>&nbsp;te xt" the HTML is not
pasted and there is no change in the UI.

Any thoughts? Thanks!

Aug 9 '05 #1
2 1971


colinhumber wrote:
I'm running this line of code:

oTarget.pasteHT ML(formattedHtm lText);

where oTarget is a text range object. However, if formattedHtmlTe xt is "<BUTTON
class=placeHold er>[[ContAmt]]</BUTTON>&nbsp;te xt" the HTML is not
pasted and there is no change in the UI.


The documentation here
<http://msdn.microsoft. com/library/default.asp?url =/workshop/author/dhtml/reference/methods/pastehtml.asp>
says: "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."

So the results depend on where you try to paste some HTML snippet and on
what IE regards as "well-formed HTML text fitting" into a given range.

Perhaps it helps to wrap the above into <span></span> but as you have
not even said us where you try to paste the above HTML it is not
possible to test whether that helps.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 9 '05 #2
Thanks for the reply. It's being pasted inside a <div> tag.

Aug 9 '05 #3

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

Similar topics

3
2717
by: Simon Wigzell | last post by:
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">
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.
1
3302
by: Roberto Castro | last post by:
I have some problems with the way I am showing the BLOB fields in the Image web controls. It does work on my localhost though sometimes I need to hit Refresh for the images to load properly. However, when I try to access the same page from another machine or when I test the code on a remote server the images just wouldn't show. The page I am talking about has 3 Image web controls. In the CodeBehind I am loading these controls by using an...
4
2120
by: qbproger | last post by:
I'm developing a plugin for some software. The previous version of the software didn't require a start in directory to be set. This allowed me to leave the working directory to the default in the project. Now I have to get my plugin working with the newer version of the software. When I start the debugger with it aimed at that program and my program installed, the program doesn't run properly unless I have the Working Directory set to...
3
13961
by: RobertS | last post by:
I'm trying to figure out what I need to do to configure IIS 5.1 on XP Pro to work when referencing WebResources.axd. For example, I have an aspx script that works fine when run from Visual Web Developer 2005 (Express Edition) built-in web server, but fails when run under IIS (same file, same location). I think I've tracked the problem to a failure of IIS to find WebResources.axd. For example, if I point IE to the src centerated by the...
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,
3
2013
by: rajasree | last post by:
Hi all, am doing a project in PHP. my javascript code is working properly in ie. But its not working in firefox. Please help me my code is as follows; <script language="javascript" type="text/javascript"> function call() { var box=new Array(50);
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
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.