<script type="text/javascript">
function openpopup(pop){
var pop1=window.open(this.pop , "", "width="+(screen.width-10)+", height="+(screen.height-10)+",hotkeys=no,scrollbars=yes");
}
</script>
<a href ='#' onClick="javascript:openpopup(showLongMessage.this)">Show More </a>
IT出现以下错误 没有路由将“/ undefined”与{:method =&gt;:get}
匹配答案 0 :(得分:1)
Href可以包含将在打开的窗口的上下文中执行的javascript:
<script type="text/javascript">
function openpopup(pop){
var escaped = pop.replace(/"/g, """).replace(/'/g, "\\'");
var pop1=window.open("javascript:document.write('" + escaped + "');document.close();",
"", "width="+(screen.width-10)+",height="+
(screen.height-10)+",hotkeys=no,scrollbars=yes");
}
</script>
<a href="#" onclick="openpopup('some \'long\' "text"');return false;">
Show More
</a>
答案 1 :(得分:0)
您必须在弹出窗口中指定要打开的页面的网址。
window.open('http://www.mydomain.com/mypopuppage.html','name','height=200,width=150')
我打赌你当前的代码
this.pop
返回'undefined'