让我们说,我们已经下面的超链接代码如何将两个文本超链接
<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
任何帮助〜谢谢
您忘记了URL中的“http://”。以任何协议或'/'开始的链接都与当前的url /路径有关。 – ThiefMaster