Entry
How do you use a function variable from the parent page in the child page?
May 8th, 2002 06:43
Jean-Bernard Valentaten, Ted Ciotti, This is the code that I am using:
Ted wrote:
> ****************************************
> parent ~ index.html
>
> <script language="JavaScript">
> function PrintImage(Image2Print){
> window.open('print.html', 'print', 'width=500,height=500')
> }
> </script>
Well, if you modify this code, it will work:
<script language="JavaScript">
var Image2Print = '';
function PrintImage(myImg)
{
Image2Print = myImg
window.open('print.html', 'print', 'width=500,height=500')
}
</script>
That's it.
> <A href="JavaScript:PrintImage('01.jpg');"><img border="0"
> src='01t.jpg' width="75" height="75"></a>
> ****************************************
> child ~ print.html
>
> <body onload="javascript:window.print();">
> <script language="JavaScript">
> document.write('<img border="0" src="'+parent.Image2Print+'">');
> </SCRIPT>
>
> ****************************************
>
>
> Thank you for your help!!
>
> Ted
Jean