I am relatively new to javascript, and completely new to xml files.
I was accessing a page for an image url to switch out the url of one on another page (all on the same domain).
With some help in another forum on this site, I ended up with a script to do so, but it's clashing with programming on the site (a purchased program - nothing I can change)
So my next idea is to do the same, but to pull from the xml rss feed in an iframe. Below is what I have for that.. how would I do this for xml files, to get an image url from within an
Here's the section within the xml file that I'm trying to get to:
<description><![CDATA[<span class="full-image-float-left ssNonEditable"><span><img src="http://www.website.com/storage/image...=1314647067762" alt="" /></span></span>test entry 1 text]]>
</description>
I was accessing a page for an image url to switch out the url of one on another page (all on the same domain).
With some help in another forum on this site, I ended up with a script to do so, but it's clashing with programming on the site (a purchased program - nothing I can change)
So my next idea is to do the same, but to pull from the xml rss feed in an iframe. Below is what I have for that.. how would I do this for xml files, to get an image url from within an
Code:
<script type="text/javascript" language="JavaScript"> function find_div_class() { var iframe = document.getElementById('IFrame1'); var innerDoc = iframe.contentDocument || iframe.contentWindow.document; var info = innerDoc.getElementsByClassName("list-journal-entry-wrapper")[0]; var theURL = null; // assume not found var spans = info.getElementsByTagName("span"); for ( var s = 0; s < spans.length; ++s ) { // have to search through spans for the class name: var span = spans[s]; if ( span.className.indexOf("full-image-float-left") >= 0 && span.className.indexOf("ssNonEditable") >= 0 ) { // we found the right one // get FIRST image inside that span: var image = span.getElementsByTagName("img")[0]; // and then the image link: theURL = image.src; break; // quit when we find first one } } if ( theURL == null ) { alert("I can't find the darned thing!"); } else { var img = document.getElementById('lead1'); img.src = (theURL); return false; } } </script>
<description><![CDATA[<span class="full-image-float-left ssNonEditable"><span><img src="http://www.website.com/storage/image...=1314647067762" alt="" /></span></span>test entry 1 text]]>
</description>
Comment