![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - IMAGE DISPLAY >Thread Next - Re: IMAGE DISPLAY Re: IMAGE DISPLAYTo: NULL Date: 8/5/2007 9:45:00 PM
"Simon Gare" <simon@s...> wrote in message
news:eAPCVfs1HHA.6128@T......
> Hi all,
>
> need to display an image from an url in an xml page but cant seem to make
it
> happen, doesnt matter what i put in the image src=" it wont parse the url.
>
> The lines of code below are
>
> XML File
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> - <guestbook>
> - <ROOT>
> <jID>27613</jID>
> <jVehicletype>images/SQLimages/VTypeStandard.gif</jVehicletype>
> <jDriverNo>8</jDriverNo>
> <jStatus>Select Status</jStatus>
> <jCustomerID>The Gare Group</jCustomerID>
> <jTimeOfBooking>21/07/2007 17:30:00</jTimeOfBooking>
> </ROOT>
>
> iIN THE JS FILE
>
> document.getElementById("bVehicle_type").value=
> xmlDoc.getElementsByTagName("jVehicletype")[0].childNodes[0].nodeValue;
>
> IN THE ASP PAGE
>
>
> <img src="<%= bVehicle_type%>" border="0">
>
> I know the above doesnt work but if someone could fill in the balnk I
would
> be grateful.
>
I'm going to assume "bVehicle_type" is the intented ID of the img element
which you are trying to assign a src value to.
var img = document.getElementById("bVehicle_type")
var src = xmlDoc.selectSingleNode("/guestbool/ROOT/jVehicletype")
if (src) img.src = '/' + src.firstChild.nodeValue
The asp page would contain:-
<img id="bVehicle_type" src="/images/spacer.gif" />
where spacer.gif is a single pixel transparent gif.
There is an assumption that the images folder is held at the root of the
site. If not you need to ensure the url supplied from the XML to the src
attribute is correctly adjust to the base url of the page.
--
Anthony Jones - MVP ASP/ASP.NET
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
