PDA

View Full Version : displaying a selected image on a page



chrismccoy
Mar 11th, 2007, 04:33 PM
can anyone point me in the direction of a snippet.

i want to pass the variable of an image and display it on a html page

like image.html?id=test.jpg

Mr J
Mar 11th, 2007, 05:40 PM
Place this basic example script in the head section of image.html



<script type="text/javascript">

var dataPassed = ""
if (location.search.length > 0){
dataPassed = unescape(location.search.substring(1))
document.write("<img src=\""+dataPassed+"\">")
}

</script>



You link would then be


<a href="image.html?test.jpg">Test Image</a>

For more indepth examples see

www.huntingground.freeserve.co.uk/scripts/passdata/p_data1.htm

and scroll down the page a bit