此页面必须以纵向格式打开,尺寸为400 x 350(px)。我不确定我是否需要使用javascript或CSS来实现这一点,但这是我尝试过的:
链接到新页面“index.html”的链接“form.html”:
<a style="text-decoration:none" href="form.html">Request
Information</a>
“form.html”的HTML:
<html>
<head>
<title>Sean's Hardware Store</title>
<script src="form.js"></script>
</head>
<body leftmargin=0 rightmargin=0>
<br>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=95% align=right bgcolor=#ffffff>
<img src="logo.jpg"><br>
<font face=arial></font> </td>
<td bgcolor=#ffffff> </td>
</tr>
</table>
<br><br>
<center>
<table width=85%>
<tr>
<td valign=top>
<form method=post action="">
Name:<br>
<input name="textname" size=35><br><br>
E-mail:<br>
<input name="textname" size=35>
<br><br>
<input type=submit name="button1" value="Submit">
</form>
</td>
</tr>
</center>
</body>
</html>
Javascript:
window.onload=function() {
document.getElementById("window").onchange=function() {
window.open("","newWin","width=400,height=350");
setTimeout(function() {
document.forms[0].submit();
},100);// allow IE to get over the shock of opening a window
}
}
另外,索引和表单是否可以链接到同一个javascript文件?现在我有两个单独的js文件,因为我不希望它们互相干扰(索引也有一些js)。谢谢。
答案 0 :(得分:0)
您可以直接从HTML中执行此操作:
<a href="form.html" onclick="window.open(this.href,'targetWindow',
'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes,
resizable=yes,width=400, height=350');
return false;">Request Information</a>