In example1.html:
<a href="https://stackoverflow.com/questions/3724106/example2.html?myVar1=42">a link</a>
<a href="example2.html?myVar1=43">another link</a>
or generate the links with Javascript as desired. Just make sure the ?varName=value gets onto the end of example2.html somehow.
Then, in example2.html, you use Javascript to parse the query string that example2 came with.
To do this, you could try Querystring.
// Adapted from examples on the Querystring homepage.
var qs = new Querystring();
var v1 = qs.get("myVar1");
Alternatively, parent.document.URL contains the complete URI for the page you’re on. You could extract that:
parent.document.URL.substring(parent.document.URL.indexOf('?'), parent.document.URL.length);
and parse it manually to pull the variables you encoded into the URI.
EDIT: Forgot the ‘new’ part of ‘new Querystring()’. Oops…