Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Wednesday, March 28, 2012

view images through xml

I am trying to create a slideshow that has some text and an image. I am able to scroll through the xml file and display the text elements. My problem is with the images. Can anyone help? Thanks

XML:

<?xml version="1.0" encoding="iso-8859-1" ?>
<dogs>
<info>
<name>Archer</name>
<handler>P.O. 1</handler>
<skills>Drugs</skills>
<birthday>4</birthday>
<imagesrc>Images/K9/Dogs/Archer.jpg</imagesrc>
</info>

code:

<xml src="http://pics.10026.com/?src=XML/dogs.xml" id="xmldso" async="false"></xml>

<table width="100%">
<tr>
<td style="width:50%;" align="right">
<span datasrc="#xmldso" datafld="imagesrc"></span>
</td>
<td style="width:50%;" align="left">
<table style="border: activeborder 1px solid">
<tr><td class="TableBottom" width="70">Name:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="name"></span></td></tr>
<tr><td class="TableBottom" width="70">Handler:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="handler"></span></td></tr>
<tr><td class="TableBottom" width="70">Skills:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="skills"></span></td></tr>
<tr><td class="TableBottom" width="70">Birthday:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="birthday"></span></td></tr>
<tr><td width="70"></td><td width="100"></td></tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<A href="http://links.10026.com/?link=JavaScript:moveprevious()"> Back</A>
|
<A href="http://links.10026.com/?link=JavaScript:movenext()"> Next</A>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<INPUT TYPE="text" WIDTH="100" NAME="Number" style="border:0; text-align:center;">
</td>
</tr>
</table>

<SCRIPT LANGUAGE="JavaScript">

function Start()
{
x=xmldso.recordset;
document.Canine.Number.value=x.absoluteposition+" of "+x.recordcount;
// document.getElementById("mypic").src =x.recordset("imagesrc") ;
}

function movenext()
{
x=xmldso.recordset;

if (x.absoluteposition < x.recordcount)
{x.movenext();}
else if (x.absoluteposition = x.recordcount)
{x.movefirst();}

document.Canine.Number.value=eval(x.absoluteposition);
document.Canine.Number.value=x.absoluteposition+" of "+x.recordcount;
}

function moveprevious()
{
x=xmldso.recordset;

if (x.absoluteposition > 1)
{x.moveprevious();}
else if (x.absoluteposition = 1)
{x.movelast();}

document.Canine.Number.value=eval(x.absoluteposition);
document.Canine.Number.value=x.absoluteposition+" of "+x.recordcount;
}

</SCRIPT>

Change this line <span datasrc="#xmldso" datafld="imagesrc"></span>

to <img datasrc="#xmldso" datafld="imagesrc" />

use the img html control instead of the span control. I tested this in my local machine and works fine

let us know

I tired that and did not work. When I scroll through the images, all I get the the missing image with the red x where the image should be.


Well, it should work. do you have the following image?

Images/K9/Dogs/Archer.jpg

right click the red icon and see the image path.


Yes, I have the image. I even moved it to the same folder as the xml file in case the path was not accurate.


Chris,

I am using IE 7 and it works fine. Which browser and what version are you using?


Forget my last comment. It did work. I did not properly refresh the xml file. Thanks for your help. It is appreciated.

view problem within cc1:ModalPopupExtender ..

I have a view problem within cc1:ModalPopupExtender .. when I click an asp image button the specified panel located most top-left in a page even I do not use x or y ModalPopupExtender properties

this problem happens only with ie

in firefox everything works fine ..

here is ModalPopupExtender code :

<cc1:ModalPopupExtender ID="ModalPopupExtender3" runat="server"
TargetControlID="submitBuyImgBt"
PopupControlID="Panel1"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="OkButton"
OnOkScript="onOk()"
CancelControlID="CancelButton" />

any help would be greatly appreciated

why it's position always in top left side of the page ?


what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}


Mezzaluna:

what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}

I have CSS but it's still not working .. but both panel and moalPopupExtender located in a web user control ( .ascx )

does the problem because of this ?

Note that every thing works fine in firefox. however not fine in ie6 or above


Not sure on that then. I always have the opposite problem. I get things to work in IE and they fail in Firefox.