开发者

Open external js form on new window

Having problem to open form in new window, script is pulled 开发者_开发问答from external service. Take a look CODE on JSfiddle

regards


You can add a target attribute to the form after its been rendered;

<html>
<head>
<script type="text/javascript">
function fixform() {
   //ism is created by the opentable.com script
   document.forms["ism"].setAttribute("target", "_blank");
}
</script>
</head>
<body onload="fixform();">
    <div id="book-table">
    <div id="OT_searchWrapperAll">
            <script type="text/JavaScript" src="http://www.opentable.com/ism/?rid=35449"></script>
            <noscript id="OT_noscript">
                <a href="http://www.opentable.com/single.aspx?rid=35449&restref=35449&rtype=ism">Reserve Now on OpenTable.com</a>
            </noscript>
        </div>
    </div>
</body>
</html>

Update Try removing the onload="fixform();" and use the jQuery equivalent;

$(document).ready(function() {
   document.forms["ism"].setAttribute("target", "_blank");
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜