Click to See Complete Forum and Search --> : Popup window from frames
TheBest42
04-23-2003, 02:17 PM
I can make a popup window from a normal html file using this code:
function popup(mylink, windowname)
{
if (! window.focus)return true;
window.open(mylink.href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
<a href="SnapSwiss.gif" onClick="return popup(this, 'SwissProt Accession #')">accession number</a>
But no matter where I put the function code in the frames html it wont work. What special code do I need to make it open from a frames page? Thanks.
-Ted
khalidali63
04-23-2003, 02:25 PM
just your window name param is causing problem....take a look at this
<a href="images/bw_01.jpg" onClick="return popup(this, 'SwissProtAccessionNum_1')">accession number</a>
TheBest42
04-23-2003, 02:50 PM
Sorry, that wasn't it. Does it matter where my <script> tags are (i.e. the index file or the frame file)?
khalidali63
04-23-2003, 02:59 PM
not really you only need to know to access your script from other frames,to make your life simple,its better to put them in the frame where you have the link
TheBest42
04-23-2003, 03:16 PM
Ok, so I have the script in the same file as the link. When I try and load it in my browser it says that there is an invalid argument in the line with window.open(). Any ideas?
khalidali63
04-23-2003, 03:32 PM
you still have some character in the window name param value that is causing this..either use the format I posted above or play with it..its the characters which are not allowed in the windowName value that are causing this.
TheBest42
04-23-2003, 03:56 PM
Got it, it works now, thanks. Now the picture that is being popped up is automatically resized to fit in the popup window. Do you think that is just the browser doing it or is there a way I can set the javascript to not resize the picture? Thanks again.
khalidali63
04-23-2003, 04:00 PM
you should be able to set picture size and the window size as well,using js