Link to home
Start Free TrialLog in
Avatar of tomlachecki
tomlachecki

asked on

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?
Avatar of knightEknight
knightEknight
Flag of United States of America image

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>
Or, a shorter version of the same thing:

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

 <IMG name='myimage'>

</body>
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tomlachecki
tomlachecki

ASKER

Adjusted points to 50
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