A
Amir
Hi,
I'd like to know if it's possible to pass an image name (the IMG SRC
attribute) from HREF element to a function that is activated by onClick
event and creates a Web page.
I have this HREF element:
<A HREF onClick="showLargePicture()"><IMG HEIGHT=25 SRC="test01.jpg"></A>
When an user clicks on the picture, the following code is performed:
function showLargePicture() {
var lines="";
lines+="<HTML><HEAD>";
lines+="<TITLE>Any Title</TITLE>";
lines+="</HEAD>";
lines+="<BODY onClick = 'window.close()'>";
lines+="<IMG SRC='test01.jpg'>";
lines+="<BR>";
lines+="Click on the window to closes it";
lines+="</BODY></HTML>";
var newWin=window.open();
newWin.document.open();
newWin.document.write(lines);
newWin.document.close();
newWin.focus();
}
Is it possible to modify the code so it'll pass the SRC attribute to the
function and thus to use it with any picture on the parent Web page?
Thanks!
I'd like to know if it's possible to pass an image name (the IMG SRC
attribute) from HREF element to a function that is activated by onClick
event and creates a Web page.
I have this HREF element:
<A HREF onClick="showLargePicture()"><IMG HEIGHT=25 SRC="test01.jpg"></A>
When an user clicks on the picture, the following code is performed:
function showLargePicture() {
var lines="";
lines+="<HTML><HEAD>";
lines+="<TITLE>Any Title</TITLE>";
lines+="</HEAD>";
lines+="<BODY onClick = 'window.close()'>";
lines+="<IMG SRC='test01.jpg'>";
lines+="<BR>";
lines+="Click on the window to closes it";
lines+="</BODY></HTML>";
var newWin=window.open();
newWin.document.open();
newWin.document.write(lines);
newWin.document.close();
newWin.focus();
}
Is it possible to modify the code so it'll pass the SRC attribute to the
function and thus to use it with any picture on the parent Web page?
Thanks!