如何做 提交按钮会弹出 window 并带有指向其他站点的图像?
how to do Button submit gets a pop a window with an image directing to other site?
我正在尝试使用提交按钮打开带有图像的弹出窗口 window,然后单击该图像,应该会打开一个站点。
这是我的代码。
<button type="submit" onclick="myImg()" formenctype= "multipart/form-data" style= " width: 8em; height: 3em; font: bold 14px sans-serif;border-radius:20px;">Send</button>
<SCRIPT>
window.onbeforeunload=confirmExit;
function myImg(){
window.name = "thiswin";
newwin=open("http://lynx.radiocompetitions.net/wp-content/uploads/2015/04/lynx-banner.png", "dispwin",
"width=250,height=300,scrollbars=no, menubar=no");
}
</SCRIPT>
问题是,按钮不起作用。
它工作得很好。
您在评论中确实提到您已将其放入wordpress。确保它不与任何东西冲突。您 运行 是否有调试器并加载了要检查的页面? (如果不使用 firebug Firefox 插件之类的东西)运行 控制台并单击按钮以查看它是否 returns 错误。 Wordpress 和 wordpress 插件可能会让人头疼。
检查一下你把它放在哪里了,在收盘前的最底部还是在header?根据您使用的插件以及这些插件的开发人员在创建它们时是否做了正确的事情,它们可以再次改变位置。
请看下面fiddle。希望对你有所帮助。
http://jsfiddle.net/twsq5L43/5/
function myImg(){
window.name = "thiswin";
var imagePath = "http://lynx.radiocompetitions.net/wp-content/uploads/2015/04/lynx-banner.png";
newwin=open("", "dispwin",
"width=750,height=300,scrollbars=no, menubar=no");
var otherWebsiteURL = "http://www.google.com";
newwin.document.write("<div><a href='"+otherWebsiteURL+"'><img src='"+imagePath+"'></a></div>");
}
我正在尝试使用提交按钮打开带有图像的弹出窗口 window,然后单击该图像,应该会打开一个站点。
这是我的代码。
<button type="submit" onclick="myImg()" formenctype= "multipart/form-data" style= " width: 8em; height: 3em; font: bold 14px sans-serif;border-radius:20px;">Send</button>
<SCRIPT>
window.onbeforeunload=confirmExit;
function myImg(){
window.name = "thiswin";
newwin=open("http://lynx.radiocompetitions.net/wp-content/uploads/2015/04/lynx-banner.png", "dispwin",
"width=250,height=300,scrollbars=no, menubar=no");
}
</SCRIPT>
问题是,按钮不起作用。
它工作得很好。
您在评论中确实提到您已将其放入wordpress。确保它不与任何东西冲突。您 运行 是否有调试器并加载了要检查的页面? (如果不使用 firebug Firefox 插件之类的东西)运行 控制台并单击按钮以查看它是否 returns 错误。 Wordpress 和 wordpress 插件可能会让人头疼。
检查一下你把它放在哪里了,在收盘前的最底部还是在header?根据您使用的插件以及这些插件的开发人员在创建它们时是否做了正确的事情,它们可以再次改变位置。
请看下面fiddle。希望对你有所帮助。
http://jsfiddle.net/twsq5L43/5/
function myImg(){
window.name = "thiswin";
var imagePath = "http://lynx.radiocompetitions.net/wp-content/uploads/2015/04/lynx-banner.png";
newwin=open("", "dispwin",
"width=750,height=300,scrollbars=no, menubar=no");
var otherWebsiteURL = "http://www.google.com";
newwin.document.write("<div><a href='"+otherWebsiteURL+"'><img src='"+imagePath+"'></a></div>");
}