Specifying data in <A HREF=""> for page content

I have a website for Star Trek, and I'm creating an object database for the game Star Trek: Generations.

I don't want to create a page for each image, and I don't want them on the same page so can I use something like:

<!-- ON THE OBJECT PAGE -->
<IMG NAME="object">

<!-- ON THE INDEX PAGE -->
<A HREF="objectpage.html" object="image1.gif">IMAGE 1</a><br>
<A HREF="objectpage.html" object="image2.gif">IMAGE 2</a>

If not, what can I use?
tomlacheckiAsked:
Who is Participating?
 
knightEknightConnect With a Mentor Commented:
DOH!  I had a typo.  Let's try again:

<A HREF="objectpage.html?image1.gif">IMAGE 1</a><br>
<A HREF="objectpage.html?image2.gif">IMAGE 2</a>

.... then in objectpage.html:


<BODY onLoad='document.images["myimage"].src=location.search.substring(1);'>

   <IMG name='myimage'>

</body>
0
 
knightEknightCommented:
Try this:

<A HREF="objectpage.html?image1.gif">IMAGE 1</a><br>
<A HREF="objectpage.html?image2.gif">IMAGE 2</a>

Then in objectpage.html, do this:

<SCRIPT language='javascript'>
  var theImage = new Image();
  theImage.src = location.search.substring(1);
</script>

<BODY onLoad='document.images.myimage.src=theImage.src'>

<IMG name='myimage'>

</body>
0
 
knightEknightCommented:
Or, a shorter version of the same thing:

<BODY onLoad='document.images['myimage'].src=location.search.substring(1);'>

 <IMG name='myimage'>

</body>
0
 
tomlacheckiAuthor Commented:
Adjusted points to 50
0
 
tomlacheckiAuthor Commented:
Thanks - I can't believe how quickly I could implement that code and it just, well, worked!

I've always been trying this sort of thing but never accomplished it.

I've awarded you an A, and your comment is now an answer.

Could I post this code if someone asked *me* how to do it (anywhere) or would I need to mention your name?

In the meantime, check out my site at http://www.deep-space-5.org.uk and I can be reached at ds5@timanfaya.freeserve.co.uk or a number of other addresses.

Thanks again - it's unbelievable!!!!!!

T
0
All Courses

From novice to tech pro — start learning today.