[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 780
  • Last Modified:

I need to fix my Java script to open a new window and if clicked again it brings the existing open window to the front

I need to make my java script and html link open the linked "tom.html" page in a new window. The java script is set to bring an opened "tom.html" window to the front if clicked again. But I can't seem to get the script to open the "tom.html" file into a new window.

I also need to remove the new window's resize, menu, tools, status, scroll of the newly opened "tom.html" window if it is possible to accomplish with thie java script.

Thanks
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
	<head>
		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
		<title>ee</title>
		<link href="css/basic.css" type="text/css" rel="stylesheet" media="all" />
	</head>
 
	<body bgcolor="black">
		<p>
			<script>
    function activate(w) {
      win=window.open("tom.html",w); window.resizeTo(294, 104); // get a handler for the window, old or new
      win.focus();           // BRING TO FRONT
    }
    if (window.name=="") window.name="Master"; //name for nameless window
  </script>
			<a href="tom.html" target="child" onclick="activate('child')"><span class="UpperNav">Music by Tom</span></a></p>
	</body>
 
</html>

Open in new window

0
Michael
Asked:
Michael
2 Solutions
 
hieloCommented:
Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!-- http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_23149594.html -->
<html xmlns="http://www.w3.org/1999/xhtml">
 
	<head>
		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
		<title>ee</title>
		<link href="css/basic.css" type="text/css" rel="stylesheet" media="all" />
	</head>
 
	<body bgcolor="black">
 
			<script type="text/javascript">
var win = null;//handle to new window
function activate(w)
{
    	if(win && win.closed==false)
    	{
		win.focus();
	}
	else
	{
     	win=window.open("tom.html",'win','height=104,width=294,status=yes,toolbar=no'); 
 
		//win.resizeTo(294, 104); // get a handler for the window, old or new
     	win.focus();           // BRING TO FRONT
	}
return false;
}
    if (window.name=="") window.name="Master"; //name for nameless window
  </script>
			<p><a href="tom.html" target="child" onclick="return activate('child');"><span class="UpperNav">Music by Tom</span></a></p>
	</body>
 
</html>

Open in new window

0
 
thirdCommented:
I suggest you use this method

http://www.quirksmode.org/js/croswin.html
0
 
MichaelAuthor Commented:
Thanks for the help!!! The music player pop up window is working great!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now