473,473 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Image is not displayed in IE Browser Using Editor

1 New Member
I have used rich text editor for Content management system.In this editor, have a InsertImage icon.We click that, select images from galley and insert the image.In firefox, it's simply placed in Editor. But IE it's placed in top of the page.


Used code:

function rteInsertHTML(html) { if (document.all) { var oRng = document.getElementById(rteName).contentWindow.doc ument.selection.createRange(); oRng.pasteHTML(html); oRng.collapse(false); oRng.select();} else { document.getElementById(rteName).contentWindow.doc ument.execCommand('insertHTML', false, html);}
}


In IE it's come in if loop, In fierfox, it's come in else condition(so image displayed).
Apr 10 '08 #1
1 2182
pronerd
392 Recognized Expert Contributor
Please use code tags when posting code so that it can actually be read.

Expand|Select|Wrap|Line Numbers
  1.     function rteInsertHTML(html) { 
  2.         if (document.all) { 
  3.             var oRng = document.getElementById(rteName).contentWindow.document.selection.createRange();      
  4.             oRng.pasteHTML(html); 
  5.             oRng.collapse(false); 
  6.             oRng.select();
  7.         } else {        document.getElementById(rteName).contentWindow.document.execCommand('insertHTML', false, html);
  8.         }
  9.     }
  10.  
See that is much easier to read...... although it could still be better.

Ok first RTF (Rich Text Format) editors do not create HTML so if you are intending to use this in a browser it is not likely to work.

Secondly there is intentional logic here to treat IE and FF differntly. So your problem is likely inside the "if (document.all)" test. That is the section that is specific to IE.

Third did you create the JavaScript in this file? It looks incomplete. There are references to variables like "rteName" that are not defined.

Fourth it is extremely unlikely that what ever element is being referenced by the value in "rteName" has a collapse() or select() function.

Fith is even less likely that the element being referenced by the value in "rteName" has contentWindow.document.selection child elements. Or that the contentWindow.document.selection child elements have a createRange() function.
Apr 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Donjuan | last post by:
Hi all I have trouble with tracking whether my image file is loaded. i use DHTML to change my image. HERE is the code: <img name="someimage" src="1.jpg"...
10
by: Jaz | last post by:
Hello all, I'd like to have a background image bleed of the right side of my page, but I don't want the page to stretch out with a scroll bar. How might I go about this? I can't make it a...
7
by: Dan Nash | last post by:
Hi I'm trying to create an external stylesheet for use in my Web App. It works fine, and I've got it linked and everything. The only problem is the "background-image" property isn't working. ...
3
by: Kristof Thys | last post by:
Hello, I'm writing a ASP.net webservice wich will visualize an image, generated by another application. The generated image is a char*. I can transform this to a String*, but I want to view it...
17
by: santel_helvis | last post by:
Hi All, Could anyone tell me how to rotate the image in javascript. Which concepts I should concentrate to rotate the image
4
by: Doug van Vianen | last post by:
Hi, I have the following coding on a web page. It causes two pictures (pic1.jpg and pic2.jpg) to show, one above the other and then when one clicks on the top picture is squeezes to the left...
4
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
0
by: David | last post by:
Hello all. I am trying to implement my first server control and have run into two problems that I cannot solve. I need the assistance of someone with more experience. My goal was to create an...
11
by: shapper | last post by:
Hello, I am displaying an image on a few pages. The image size is 50 px height and 50 px width. In some pages I need the image to be 30x30 px in others 40x40 px and in others 50x50px. Can I...
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
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...
0
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...
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
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.