Hello,

Is there a way to change the target name of a pop-up window?

If you check out my site you will see the issue I am having. What happens is when you click on "Open Chat Window" and then click on "Detach Jukebox" they populate in the same pop-up. So you can't have both windows open at the same time. :sad:

If I could change the name of the pop-up's target to "_chat" or "_jukebox" instead of "_blank" perhaps I could have both pop-ups open.

The site is http://www.stateofhumanity.org - check it out and you will see the issue.

Let me know if you know what I can do about this issue.

Recommended Answers

All 12 Replies

That's pretty much how you do it...except without the leading underscore.

target="chat" and target="jukebox"

How do I identify the pop up as "chat" What code would I place in the html document?

Odin

<a href="linked.html" target="newwin" >link</a>

or
window.open(URL, name [, features])

<a href="javascript: window.open('http://whatever.com', 'tinyWindow', 'toolbar,width=150,height=100')">new window</a>

Ok so far it works. Except the window that has the link also goes to another page and says "[object Window]" What can I do?

As you can tell I am not a coder.:sad:

Thanks for all the support.

Odin

show me the code you are using

try this

javascript

<script type="text/javascript">
  function popUp(URL) {
    day = new Date();
    id  = day.getTime();
    
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,left=125,top=100,width=500,height=500');"); 
  }
</script>

html

<a href="javascript:popUp('http://www.stateofhumanity.org/chatwindow.html')">popup window</a>

p.s. no need to add window names...and put the script in the head section.

try this

javascript

<script type="text/javascript">
  function popUp(URL) {
    day = new Date();
    id  = day.getTime();
    
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,left=125,top=100,width=500,height=500');"); 
  }
</script>

html

<a href="javascript:popUp('http://www.stateofhumanity.org/chatwindow.html')">popup window</a>

p.s. no need to add window names...and put the script in the head section.

Hmmm. I am going have to give this a more indepth look. The Html didn't work. And I am not familiar enough with Javascript code to implement it.:cry:

But I will continue to work at it.:cheesy:

Odin

Here is a test page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
  function popUp(URL) {
    day = new Date();
    id  = day.getTime();
    
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,left=125,top=100,width=150,height=150');"); 
  }
</script>
</head>

<body>
<p><a href="javascript:popUp('http://www.stateofhumanity.org/chatwindow.html')">popup window</a>
</body>
</html>

Here is a test page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
  function popUp(URL) {
    day = new Date();
    id  = day.getTime();
    
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,left=125,top=100,width=150,height=150');"); 
  }
</script>
</head>

<body>
<p><a href="javascript:popUp('http://www.stateofhumanity.org/chatwindow.html')">popup window</a>
</body>
</html>

Ah ha! You rocked it... :mrgreen:... Apparently you know your stuff. Send me your PayPal email so I can send you a donation...

When I have my presentation at the Dolan School of business at Fairfield University I'll be sure to mention for others to look out for your avatar on this site.

We're all volunteers here. If you'd like to express your appreciation, then why not make a donation to Daniweb? Thanks!

We're all volunteers here. If you'd like to express your appreciation, then why not make a donation to Daniweb? Thanks!

Great. No problem. I already made a donation.:cheesy:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.