...

View Full Version : Use Same Window/Reload



Erindesign
10-29-2006, 02:27 AM
I've got a popup script that opens videos in a popup window. The only problem is that when people click videos, each opens in new window and sometimes visitors forget to close one so the other just plays in the background. Is it possible to have a popup just reload the same window? (only one popup, and reloadthat one with new information if its open, otherwise open new popup.)



<SCRIPT type="text/javascript">
<!-- Begin
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,width=500,height=500');");
}
// End -->
</script>


<a href=javascript:popUp('mvid.php?vid={$video[$K][$Name]}&type={$video[$K][$type]}')\">{$video[$K][$ID]}</a><br />;

coothead
10-29-2006, 05:48 AM
Hi there Erindesign,

the script that you are using will prevent those who have javascript disabled from viewing the videos. :eek:
This example will open new windows...


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
#container li {
margin:10px 0;
}
a.popup {
font-family:verdana,arial,helvetica,sans-serif;
font-size:16px;
color:#000;
}
a.popup:hover {
color:#f96;
}
-->
</style>

<script type="text/javascript">
<!--

window.onload=function() {
var mywindow;
var w=600;
var h=400;
var l=(screen.width-w)/2;
var t=(screen.width-h)/2;
var features='width='+w+',height='+h+',left='+l+',top='+t+',scrollbars=yes';
var lnk=document.getElementById('container').getElementsByTagName('a');
for(c=0;c<lnk.length;c++) {
lnk[c].onclick=function() {
if(mywindow) {
mywindow.close();
}
mywindow=window.open(this.href,'',features);
mywindow.focus();
return false;
}
}
}

//-->
</script>

</head>
<body>

<ul id="container">
<li><a class="popup" href="http://www.google.com">google</a></li>
<li><a class="popup" href="http://www.codingforums.com">codingforums</a></li>
<li><a class="popup" href="http://www.w3c.org">w3c.org</a></li>
<li><a class="popup" href="http://www.w3schools.com">w3schools</a></li>
</ul>

</body>
</html>

coothead

Erindesign
10-30-2006, 03:55 AM
Well, what should I do? Is there any way of making a pop up in other ways?

btw I fixed the original problem.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum