日期:2014-05-20  浏览次数:20653 次

链接用click怎么处理
<a href="javascript:winopenLink('url','700','500')">XXXXXX </a>
function winopenLink(url,width,height) {  
  var xposition = (screen.width - width) / 2;
  var yposition = (screen.height - height) / 2;
  theproperty= "width=" + width + ","
  + "height=" + height + ","
  + "location=no,"
  + "menubar=no,"
  + "resizable=yes,"
  + "scrollbars=yes,"
  + "status=yes,"
  + "titlebar=no,"
  + "toolbar=no,"
  + "hotkeys=no,"
  + "left=" + xposition + ","
  + "top=" + yposition;
 window.open(url,'',theproperty);
}
 现在就是想能够获得request.getHeaders("Referer")的值或者把这个值设为不空,查了下用
var e = document.createElement("a");
 e.href = url;
 document.body.appendChild(e);
 e.click(); 能实现,但是,不是新开一个窗口。
能否新开一个窗口并且request.getHeaders("Referer") 不空。
JavaScript 函数 URL

------解决方案--------------------
引用:
Quote: 引用:

var e = document.createElement("a");
e.href = "http://www.baidu.com";
e.setAttribute('target','_blank');document.body.appendChild(e);
e.click(); 


嗯 这样是可以,但是window.open 有个参数 控制工具栏等的(theproperty) 用click()就不能关闭页面工具栏等。


JS貌似不能修改Referer,所以楼主要自己权衡了