发布网友
共1个回答
热心网友
已demo,采纳即可
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8 />
<title>Nothing</title>
<style type="text/css">
</style>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
onload = function ()
{
sendnews ();
}
function sendnews ()
{
var news = document.getElementsByName ('sendnews');
for ( var i = 0; i < news.length; i++)
{
news[i].onclick = function ()
{
centerWindow ('send.php?id=' + this.title, (screen.width - 500) / 2, (screen.height - 350) / 2, 500,
350, 'sendnews');
};
}
}
var popUpWin = 0;
function centerWindow (URLStr, left, top, width, height, title)
{
if (popUpWin)
{
if (!popUpWin.closed)
popUpWin.close ();
}
popUpWin = open (URLStr, title,
'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='
+ width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left
+ ',screenY=' + top + '');
}
</script>
</head>
<body>
<button name="sendnews">sendnews1</button>
<button name="sendnews">sendnews2</button>
<button name="sendnews">sendnews3</button>
</body>
</html>