wrote:
> Hi!
>
> Does anybody know of a way that I can keep a reference to an object
> that I can then reuse? I tried various approaches using navigator, but
> these all fail in an iframe due to premission problems.
>
> For e.g.:
> navigator.stuff = 5;
Main page :
self.stuff = 5;
or :
stuff = 5;
or/and :
if(!!parent.myIframe.stuff)
parent.myIframe.stuff = 5;
Called page :
if(!!parent.stuff)
stuff = parent.stuff;
else
alert('error with \'stuff\' !');
And if that doesn't work, try something as :
Main page :
<html>
<head>
<script type="text/javascript">
function send(page,attrib,target)
target.location.href=page+'?'+attrib;
}
</script>
</head>
<body>
<a href="pge1.htm" target="myIframe"
onclick="send(this.href,this.target,'stuff=5&name= \'foo\'');
return false;">page 1</a>
<a href="pge2.htm"
onclick="send(this.href,'self','stuff=25&name=\'tr ick\'');
return false;">page 2</a>
</body></html>
Called Page :
<html>
<head>
<script type="text/javascript">
function receiv(){
var attrib = this.location.search;
attrib = attrib.substring(1).split('&');
for(var i=0;i<attrib.length;i++)
eval(attrib[i]);
}
receiv()
if(!!name)
alert('name = '+name);
else
alert('no variable \'name\' or ...\nfunction broken');
</script>
</head>
</html>
--
Stephane Moriaux et son [moins] vieux Mac