I have been looking a bit closer, i can set up an array as the images open on a loop, they will be the only images on the page, is there a way to reference the image by index number?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><?xml version="1.0" encoding="UTF-8"?><html><head><link rel="stylesheet" href="simple.css" type="text/css" media="screen" /><script type="text/javascript">
var i;
var x;
var passablebooks;
var testing = new Array();
</script><script type="text/javascript">
function whichElement()
{
i = 6
passablebooks=(testing[i])
alert(passablebooks);
parent.passableinfo = testing[i];
}
</script></head><body><script type="text/javascript">
function handleJson(json) {
var bookurl;
var bookdescription;
x=Math.ceil(json.feed.openSearch$totalResults.$t/20);
for (i=0;i<=20;i++)
{
booktitle=json.feed.entry[i].title.$t;
bookauthor=json.feed.entry[i].dc$creator[0].$t;
bookurl=json.feed.entry[i].link[0].href;
document.write('<a href="info.html" target="Info" onclick="javascript: void"><img src="' + bookurl + '"alt="http://books.google.com/books/feeds/volumes/' + json.feed.entry[i].dc$identifier[0].$t + '?&run=1&alt=json-in-script&callback=handlequery" width="75px" height="120px" onclick="whichElement(testing);" title="' + booktitle + ' - ' + bookauthor + '" />');
testing[i] = json.feed.entry[i].dc$identifier[0].$t;
}
}
</script>
I have written the script so it passes the variable to another frame.
These lines are just for me to check
i = 6
passablebooks=(testing[i])
alert(passablebooks);
I will never know what the alt tag is going to be so need to either reference it by the image that was selected or by an array value that will be 1 less than the image index.
Bookmarks