Link to home
Start Free TrialLog in
Avatar of Dan Sheridan
Dan SheridanFlag for United States of America

asked on

Popup window that works in IE an NS

I need the html code for when I click on a link it opens the link in a small popup window. One that does not have any buttons or menus. Here's the site that I am working with.

http://www.surmodics.com/calevent/cal2nd99.html 

On Sept 1st - 4th has a link to a test page. The only reason that I stated this it's working within a table.

The code that I am using now is
<a href="#" onClick="window.open('test.html','Conference','hight=100,width=50,menubar=0,status=0');"> (cell 1 - 4) </a>

This code works inside Internet Explorer but not Netscape, can someone help?

I don't think it is that difficult, but I can't find it.

Thanks in advance
Dan
Avatar of knightEknight
knightEknight
Flag of United States of America image

FYI: mispelled "hight"
Avatar of chewymon
chewymon

In the <head>

<SCRIPT LANGUAGE="JavaScript">

<!--  Hide from old browsers

function tester(){
window.open("test.html", "myRemote","height=100,width=50);
}

      
// end hiding -->

</SCRIPT>


Where you want the link to appear:


<a href="#" onClick="tester()">
  Click Me</a>



dsheridan, look in you previous question for the problem with your page.  I'm sorry it took so long for me to get back to you.  I hate to see you give out points twice for the same question.
Just cut and paste to following code into your <head> and <body> It works for me! If it works for you I'll take the points...  thanks :-) Edi

----------------------------------------------------------------------
<html>
<head>
      <title>Popup Window</title>

<script language=javascript>
<!--
function newWin(url) {
 projWindow = window.open(url,"Projects","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=100");
 var netscape = false
 if (navigator.appName == "Netscape" && (navigator.appVersion.substring(0,1) == "3" || navigator.appVersion.substring(0,1) == "4")) {
  netscape = true; projWindow.focus()
 } else {
  netscape=false
 }
}
//-->
</script>

</head>

<body>

<br><a href="javascript:newWin('https://www.experts-exchange.com/jsp/qShow.jsp?ta=html&qid=10231904 ');"><img SRC="images/your.gif" ALT="Your image" NOSAVE BORDER=0 height=28 width=100></a></td>

</body>
</html>
Avatar of Dan Sheridan

ASKER

Chewymon, Sorry didn't work.

eqbservices, Sorry didn't work.

Remember, this is within side a table. Now someone told me that I have to put a link in each cell. Is this true? And if I do can have a link for the cell or just the text in the cell?

Please take a look the website. It  doesn't work, unless I put the code in wrong.

http://www.surmodics.com/calevent/cal2nd99.html


One other thing, is there a command that I can use to close that popup window?
For NN, yup, you'll have to repeat the hyperlink for each <TD> element.
If you're going to do that, then it's worthwhile putting the code into a function...

<html>
<head>
<script language="javascript"> <!--
var hWin = new Array();
function doIt() {
  hWin[hWin.length] = window.open( 'test.html' , 'Conference' , 'height=100,width=50' );
  return false;
}

function closewin() {
 n = hWin.length-1;
 while( n>=0 && hWin[n].closed ) {
  n--;
 }
 if(n>=0) {
  hWin[n].close();
  hWin.length = n;
 } else hWin.length = 0;
}
// -->
</script>
</head>
<body>
<a href="javascript:;" onclick="closewin()">Close a Window</a>
<table>
<tr>
<td><a href="javascript:;" onclick="doIt()">1</a></td>
<td><a href="javascript:;" onclick="doIt()">2</a></td>
<td><a href="javascript:;" onclick="doIt()">3</a></td>
<td><a href="javascript:;" onclick="doIt()">4</a></td>
</tr>
</table>
</body>
</html>

When you open a window using the window.open() method, it returns a reference to that window, so you can refer to it in your scripts..

You can then close the window using
winreference.close();

This page creates and maintains an array of the opened windows, so that they can be closed down..

Brian
Brian, within the javascript:; statement that I have for each cell
instead of having twenty diffent java functions, can I specify the filename
in the <a href></a> statment?

And also is there a way to have a close statment in the popup window itself?

Thanks
Dan

You want to launch a particular url for each link..?
No problemo :)

<html>
<head>
<script language="javascript"> <!--
function doIt(url) {
  window.open( url, '', 'height=150,width=150' );
  return false;
}

// -->
</script>
</head>
<body>
<table>
<tr>
<td><a href="javascript:;" onclick="doIt('b.htm')">b.htm</a></td>
<td><a href="javascript:;" onclick="doIt('c.htm')">c.htm</a></td>
<td><a href="javascript:;" onclick="doIt('d.htm')">d.htm</a></td>
<td><a href="javascript:;" onclick="doIt('e.htm')">e.htm</a></td>
</tr>
</table>
</body>
</html>

As for the close sitting in each window... you'd need to put that into each window...

a.htm
-----

<html>
 <body>
I'm a little teapot<br>
short and stout<br>
<a href="javascript:;" onclick="window.close();">Close Me</a>
 </body>
</html>


Brian
Thanks, post and you got it.

I have one question, where did you learn code in Java, and where is a good place to start learning java and use a good resource?

Dan
ASKER CERTIFIED SOLUTION
Avatar of brigmar
brigmar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have been a big help.

Thanks
Dan