开发者

Open external js form on new window

开发者 https://www.devze.com 2023-03-12 13:45 出处:网络
Having problem to open form in new window, script is pulled 开发者_开发问答from external service.

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

精彩评论

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