[英]Execute a JavaScript function using image onclick
我试图在单击图像时执行以下JavaScript函数(弹出一个新窗口),但不起作用。 您能帮我更正密码吗?
<script language="javascript">
var win = null;
function NewWindow(wizpage, wizname, w, h, scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition +
',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'
win = window.open(wizpage, wizname, settings)
}
</script>
<FORM>
<INPUT TYPE="Image" SRC="https://communities-
qa.connect.te.com/sites/GP/Indirect/PublishingImages/clickhere2.jpg"
Alt="Contact Us" onClick="
NewWindow('www.google.com','name','590','390','yes');return false"></FORM>
非常感谢
阻止在新窗口中打开“ https://www.google.com/ ”,因为该请求是在未设置“允许弹出窗口”权限的沙盒框架中发出的。
var win = null; function NewWindow(wizpage, wizname, w, h, scroll){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable' win = window.open(wizpage, wizname, settings) }
<FORM> <INPUT TYPE="Image" SRC="https://communities- qa.connect.te.com/sites/GP/Indirect/PublishingImages/clickhere2.jpg" Alt="Contact Us" onClick=" NewWindow('https://www.google.com','name','590','390','yes');return false"></FORM>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.