homepage Welcome to WebmasterWorld Guest from 54.196.201.253
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
newbie probs: remove element and adding image links
redpelica




msg:3410965
 9:33 pm on Aug 1, 2007 (gmt 0)

Hi,

really hope you can help. I'm trying to adapt the site favorites supercookie code from www.siteexperts.com/tips/xml/ts05/page1.asp . I'm trying create a gallery lightbox, storing local links to favorite images in a web gallery, without php/asp. But being new to xml/coding, I'm really struggling :( I need to be able to delete an element from the list generated. Just can't figure out how after hours. The code is

<HTML XMLNS:SITEINFO>
<HEAD>
<STYLE>
SITEINFO\:FAVORITES {behavior:url('#default#userData')"}
</STYLE>
<SITEINFO:FAVORITES ID="siteFavorites"/>

<SCRIPT>
function AddFavorite(sURL, sTitle) {
siteFavorites.load("favorites")
var oXMLDoc=siteFavorites.XMLDocument;
var oNode=oXMLDoc.createNode(1,"SITEINFO", "");
var oURLNode=oXMLDoc.createNode(1,"URL", "");
var oTitleNode=oXMLDoc.createNode(1,"TITLE", "");
oURLNode.text=sURL;
oTitleNode.text = sTitle
oNode.insertBefore(oURLNode,null)
oNode.insertBefore(oTitleNode,null)
oXMLDoc.documentElement.insertBefore(oNode, null);
siteFavorites.save("favorites")
}

function ListFavorites() {
siteFavorites.load("favorites")
var oXMLDoc = siteFavorites.XMLDocument.documentElement
var wList = window.open("","fav","width=300,height=200,top=0,left=0,scrollbars=yes")
wList.document.open()
wList.document.write("<TITLE> Favorite List</TITLE>")
wList.document.write("<BASE TARGET=\"_blank\">")

for (var i=0;i<oXMLDoc.childNodes.length;i++) {
with (wList.document) {
write("<A HREF=\"" + oXMLDoc.childNodes[i].childNodes[0].text + "\">")
write(oXMLDoc.childNodes[i].childNodes[1].text)
write("</A><BR>")
}
}
wList.document.close()
}

</SCRIPT>

<BODY>

<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>

</TD>
<TD WIDTH=5></TD><TD valign=top ID=article><P class=start STYLE='text-align: left'>&nbsp;</P>

<P><BR>
<INPUT TYPE=button VALUE="ex1" ONCLICK='AddFavorite("http://www.blank.co.uk/forexample1","example site1")'>
<BR><INPUT TYPE=button VALUE="ex2" ONCLICK='AddFavorite("http://www.blank.co.uk/forexample2","example site2")'>
<BR><INPUT TYPE=button VALUE="ex3" ONCLICK='AddFavorite("http://www.blank.co.uk/forexample3","example site3")'>
<P>

<BR><INPUT TYPE=button VALUE="List Favorites" ONCLICK="ListFavorites()">

</TD></TR>

</TABLE>
</BODY>
</HTML>

If anyone also knows how to make the generated hyperlinks images that link to urls, that'd really make my month :). But either way, any help or hints hugely appreciated. Thanks very much.

 

cmarshall




msg:3410988
 9:57 pm on Aug 1, 2007 (gmt 0)

Boy, I haven't a clue, but that's not because I don't know enough about XML, it's because this seems to be a JavaScript problem, and one that is related specifically to the XML parser system that you're using. I've never used it (I always use PHP or the native JS DOM tools).

You may want to try posting this in the J&A Forum [webmasterworld.com].

redpelica




msg:3411010
 10:43 pm on Aug 1, 2007 (gmt 0)

thanks, I guess it is partly javascript - though i figured the problem was as much my grasp of the xml/dom side of things ie how actually get the (javascript) synatx right for the xml. I may try reposting in the javascript forum. thanks again.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved