newimprovedmedia
Technical User
I am trying to pass just one variable to an image rotation script, I have read the FAQ on setting variable using a query string, and i know the answer is there but I am still a little confused. Here is my script:
Code:
<script type="text/javascript" language="javascript">
<!-- Hide code from older browsers
thisImg = 0
function newFolio(direction) {
if (document.images) {
thisImg = thisImg + direction
document.folio.src = "images/" + thisImg + ".jpg"
}
}
// Stop hiding code -->
</script>
</head>
Now I link to the page from an image map and put the query string into the href:
Code:
<a href="jump.html$thisImg=10">
And then modify my original script like this:
Code:
<!-- Hide code from older browsers
function getQuery(){
var queryString = location.search;
var data = queryString.slice(1,data_pre.length);
for (j=0;j<dataArray.length;j++){
thisImg = eval(dataArray[j])
}
}
function newFolio(direction) {
if (document.images) {
thisImg = thisImg + direction
document.folio.src = "images/" + thisImg + ".jpg"
}
}
// Stop hiding code -->
</script>
I am at a loss as to translate the query string into the thisImg variable, and have the main image on the page load using this information. like this?:
Code:
<img src="onload:newFolio">
Please Help!,
Web Hack