JS菜鸟问题,请高手不吝赐教。。。
如何修改下面这段代码使它变成在同一窗口打开,不要打开多个新窗口,要在同一窗口执行<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript">
/*
bb=[];
bb[1]=['asdf'];
alert(bb[1]);
str=JSON.parse('<?php echo json_encode(array ('a'=>'0','b'=>2,'c'=>3,'d'=>4,'e'=>5));?>');
for(k in str)
document.write(str[k]+"<br/>");
a=[];
for(i in a)
document.write(i);
document.write(a.length);*/
function modalDialog(url, name, width, height)
{
if (name==undefined)
{
name='_blank';
}
if (width == undefined)
{
width = 400;
}
if (height == undefined)
{
height = 300;
}
x = (window.screen.width - width) / 2;
y = (window.screen.height - height) / 2;
window.open(url, name, 'height='+height+', width='+width+', left='+x+', top='+y+', toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, modal=yes');
}
function je_open()
{
url=[];
url[0]='http://www.baidu.com/';
url[1]='http://www.baidu.com/';
url[2]='http://mp3.baidu.com/';
url[3]='http://zhidao.baidu.com/';
url[4]='http://nes.baidu.com/';
url[5]='http://www.baidu.com/';
url[6]='http://www.baidu.com/';
je_elem=document.forms['a'].elements;
for(i=0;i<url.length;i++)
{
if (je_elem[i].checked)
modalDialog(url[i]);
}
//document.getElementById('txt').innerHTML+=i+':'+je_elem[i].checked+'<br />';
return false;
}
</script>
<form name="a" onsubmit="return je_open();">
<p><input type="checkbox"><a herf="http://www.baidu.com/">baidu</a></p>
<br/>
<p><input type="checkbox">baidu</p><br/>
<p><input type="checkbox">baidu</p><br/>
<p><input type="checkbox">baidu</p><br/>
<p><input type="checkbox">baidu</p><br/>
<p><input type="checkbox">baidu</p><br/>
<p><input type="checkbox">baidu</p><br/>
<input type="submit" type="button" value="确定">
</form>
<span id='txt'>