473,795 Members | 3,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can't unescape image path in Netsacpe, adding image to td

When I try to use the DOM to add an image to a table cell, it works in
IE but not in Netscape. If I look at the innerHTML of the table in
Netscape I see %5C in place of "\" in the image file path, nothing I do
corrects it. e.g.
<td><img src="C:%5CArchi ve%5Cgraphic%5C 2pitvipers.jpg" ></td>

Does anyone have any suggestions?
TIA,
Mike

<h3>Select Photo to Add to Table</h3>
<input type="file" name="imgsrc" id='imgsrc'
onchange="addRo wToTable(this.v alue);">

function addRowToTable(p hotosrc){
alert(photosrc) ;
var tbl = document.getEle mentById('tblSa mple');
var lastRow = tbl.rows.length ;
var iteration = lastRow;
var row = tbl.insertRow(l astRow);
// left cell
var cellLeft = row.insertCell( 0);
var textNode = document.create TextNode(iterat ion);
cellLeft.append Child(textNode) ;
// right cell
var cellRight = row.insertCell( 1);
//attempt 1
//var el = document.create Element('img');
//el.setAttribute ('src', unescape(photos rc));
//el.src=unescape (photosrc);
//cellRight.appen dChild(el);
//attempt 2
cellRight.inner HTML="<img src='"+decodeUR IComponent(phot osrc)+"'>";
cellRight.inner HTML=decodeURIC omponent(cellRi ght.innerHTML);
//attempt 3
//var el = new Image();
//el.src=unescape (photosrc);
//cellRight.appen dChild(el);
}

<table border="1" id="tblSample" >
<tr>
<th colspan="2">Use r Selected Photos</th>
</tr>
</table>
Sep 10 '05 #1
4 1764
hugo2, sept 10, 2005
mscir wrote:
When I try to use the DOM to add an image to a table cell, it works in
IE but not in Netscape. If I look at the innerHTML of the table in
Netscape I see %5C in place of "\" in the image file path, nothing I do
corrects it. e.g.
<td><img src="C:%5CArchi ve%5Cgraphic%5C 2pitvipers.jpg" ></td>

Does anyone have any suggestions?
TIA,
Mike


Might try this:

src = "file:///[drive]:/[folder]/[path]/[fileName.ext]"

I got this from a software pro who responded to a
bug report I filed in Bugzilla.
It seems to be a universal path syntax that works
everywhere all the time.

good luck.
hugo2 ----

Sep 10 '05 #2
Hi Mike

This works for me on ie6 and Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)

<code snip>

photosrc='file:///'+photosrc;
cellRight.inner HTML="<img src='"+photosrc +"'>";

</code snip>

Chris

"mscir" <ms***@yahoo.co m> wrote in message
news:5a******** ************@pg hconnect.com...
When I try to use the DOM to add an image to a table cell, it works in IE
but not in Netscape. If I look at the innerHTML of the table in Netscape I
see %5C in place of "\" in the image file path, nothing I do corrects it.
e.g.
<td><img src="C:%5CArchi ve%5Cgraphic%5C 2pitvipers.jpg" ></td>

Does anyone have any suggestions?
TIA,
Mike

<h3>Select Photo to Add to Table</h3>
<input type="file" name="imgsrc" id='imgsrc'
onchange="addRo wToTable(this.v alue);">

function addRowToTable(p hotosrc){
alert(photosrc) ;
var tbl = document.getEle mentById('tblSa mple');
var lastRow = tbl.rows.length ;
var iteration = lastRow; var row = tbl.insertRow(l astRow); // left cell
var cellLeft = row.insertCell( 0);
var textNode = document.create TextNode(iterat ion);
cellLeft.append Child(textNode) ; // right cell
var cellRight = row.insertCell( 1);
//attempt 1
//var el = document.create Element('img');
//el.setAttribute ('src', unescape(photos rc));
//el.src=unescape (photosrc);
//cellRight.appen dChild(el);
//attempt 2
cellRight.inner HTML="<img src='"+decodeUR IComponent(phot osrc)+"'>";
cellRight.inner HTML=decodeURIC omponent(cellRi ght.innerHTML);
//attempt 3
//var el = new Image();
//el.src=unescape (photosrc);
//cellRight.appen dChild(el);
}

<table border="1" id="tblSample" >
<tr>
<th colspan="2">Use r Selected Photos</th>
</tr>
</table>

Sep 10 '05 #3
Chris wrote:
Hi Mike

This works for me on ie6 and Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)

<code snip>

photosrc='file:///'+photosrc;
cellRight.inner HTML="<img src='"+photosrc +"'>";

</code snip>

Chris


Thanks Chris, that works great!
Mike
Sep 11 '05 #4
hugo2 wrote:
Might try this:

src = "file:///[drive]:/[folder]/[path]/[fileName.ext]"

I got this from a software pro who responded to a
bug report I filed in Bugzilla.
It seems to be a universal path syntax that works
everywhere all the time.

good luck.
hugo2 ----


Thanks hugo2, just what I needed!
Mike
Sep 11 '05 #5

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

Similar topics

7
1685
by: Adam Maltby | last post by:
Hi, I am adding an new picbox and animated gif to it at runtime Dim img As Image = Image.FromFile(Application.StartupPath & "\animation.gif") With pic_Wait .Location = New Point(300, 250) .Width = 72 .Height = 101 .BackColor = Color.Transparent .BorderStyle = BorderStyle.None
2
1551
by: Prashant | last post by:
Hi, I want to add image to printer. So that while printing print will come come along with stamp image. I am doing printing by creating dc. I am not using vb.net method of using printdocument & adding graphics thorugh its event handler. How can add graphics to my device context through dotnet? Thanks
11
26643
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
10
1923
by: Confused but working on it | last post by:
Hi all, I'm trying to do something simple and grabbed a snippet from the php manual for reading files in a directory. The snippet echos out a nice list of files. <?php //Open images directory $dir = opendir("images"); //List files in images directory while (($file = readdir($dir)) !== false)
0
9672
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
10437
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...
0
10214
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
10164
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
10001
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
9042
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
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.