说实话,我根本不懂JavaScript。我一直在通过观察别人来弄清楚事情,但这次不是这样!我希望我的一个表单能够以提交为中心弹出。我已经得到它弹出并保留表格数据到目前为止,但我似乎不能让它居中!这里是一些与我一起工作的代码:Popup form centered
此外,如果有人可以向我解释这将是伟大的。我的表单动作看起来有点像document.getElementByID('Name').vaule加上电子邮件等疯狂,但表单字段ID与动作不匹配,但它仍然工作。我不知道这一个或为什么它的实际工作仍http://www.computerbytez.com/develop.html在行动的形式
方式:!
<form action="https://computerbytez.com/InstantChat/Standard/logmein.html?Name=' + document.getElementById('Name').value + '&Email=' + document.getElementById('Name').value, '', 'toolbar=no, status=no, menubar=no, titlebar=no, location=no, scrollbars=no, resizable=no, height=500, width=400'" id="lmiform">
<div class="form-field">
<label class="cm-required " for="elm_7">Name</label> <input class="input-text" id="elm_7" name="name" size="50" style="width: 100%; max-width: 372px;" type="text"/></div>
<div class="buttons-container">
<span class="button-submit button-wrap-left"><span class="button-submit button-wrap-right"><input type="submit" value="Connect To Technician" /></span></span></div>
形式的JavaScript:
$(document).ready(function() {
$('#lmiform').submit(function() {
window.open('', 'formpopup', 'width=620,height=480,scrollbars=no,resizable=no,top=200,left=200');
this.target = 'formpopup';
});
});
我也一直在搞乱这个(弹出中心的链接)和我一直在试图将两者结合在一起,没有运气:
<script>
function PopupCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
<a href="javascript:void(0);" onclick="PopupCenter('example.html', 'myPop1',620,470);"><img alt="" class="LMIpic" src="live_help_online.gif" /> </a>
任何帮助将不胜感激。谢谢
'javascript'无关用'java'。请勿误用标签。 – gdoron