假设我们有以下超链接代码
<a id="cont" href="www.first_site.com">Something</a>
我想使用以下java代码将它与弹出窗口结合起来
<script language="javascript">
var popupWindow = null;
function centeredPopup(url,winName,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
popupWindow = window.open(url,winName,settings)
}
</script>
<a href="www.second_site.com" onclick="centeredPopup(this.href,'myWindow','500','300','yes');return false">Anything</a>
有什么想法可以将两者结合起来,这样当我点击Something
第一个超链接时,它会打开弹出窗口www.second_site.com
并移动到www.first_site.com
任何帮助〜谢谢