Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: IMAGE DISPLAY

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 8/6/2007 10:01:00 PM

"Simon Gare" <simon@s...> wrote in message
news:Oh3tbhD2HHA.1168@T......
> Hi Anthony,
>
> thanks for the reply, the src is determined by the XML file as the image
is
> dynamic based on a selection which makes the src undeterminable in advance
I
> thought you could assign a dynamic value such as
>
> <img src="<%= bVehicle_type %>">
>
> but that didn't work. Are you trying to say that I need the spacer.gif
file
> in the src anyway but will be replaced by the XML value based on the image
> id?
>
> Or maybe if I Dim the aspect on the asp page itself that would work?
>


You seem to be confused about what happens on the client and what happens on
the server.

Things like this:-

<img src="<%= bVehicle_type %>">

is server side code in an asp file but this:-

document.getElementById("bVehicle_type").value = ...

is client side code running in the browser.

The answer to you question is yes unless you want an ugly "unknown image"
icon in you page you need to give your img a valid src to something
invisible.  On your client with the XML loaded you can then assign the src
element.  Like I said you need be careful that any relative url you assign
is appropriate to the pages BaseURL.


-- 
Anthony Jones - MVP ASP/ASP.NET

>
> "Anthony Jones" <Ant@y...> wrote in message
> news:eReqwF61HHA.5360@T......
> > "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
> >
> >
>
>




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent