INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Sending data between pages

How to send a string to another page e.g. simple online photo almbum by danbhala
Posted: 2 Jun 04

page1.html

<a href="page 2.html#PassedInformation">Link</a>

page2.html

this code brabs the information after the '#' charecter:
var loc=document.location.href;
var information=loc.substring(loc.indexOf("#")+1,loc.length);

this is very handy to create a template page used for photographs etc..
i.e.

Page1.html
<a href="page 2.html#Pic1">Link to Pic1</a>
<a href="page 2.html#Pic2">Link to Pic2</a>
<a href="page 2.html#Pic3">Link to Pic3</a>

Page2.html
var loc=document.location.href;
var PicName=loc.substring(loc.indexOf("#")+1,loc.length);

and in the body of page2.html:
document.write("<img src=img/"+PicName+".jpg>");

Basically you dont have to make like about 50 individual pages for your online photo album. all ya gotta do is name your pics Pic1.jpg, Pic2.jpg, Pic3.jpg etc...


-dan =)

Back to Javascript FAQ Index
Back to Javascript Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close