前言
在制作文件管理系统的时候,需要借出以及归还,需要将同一个表单内容指向不同的两个界面,因此查书发现在html5中新增了相关办法
过程
如何实现
代码如下
<body>
<h2>请输入相关信息</h2>
<form name='submit' action='borrow.php' method='post'>
<label>
学号:
<input type='text' name='sid' autofocus>
姓名:
<input type='text' name='sname'><br/><br/>
借阅物品名称:
<input type='text' name='wood'>
备注:
<input type='text' name='about'>
<button onClick='submit'>借出</button>
<button onClick='submit' formaction="return.php">归还</button>
</label>
</form>
</body>
两个内容:
1.formaction
函数后面跟随着指向的链接,可以是网址,也可以是相关文件
2.autofocus
函数也是html5新增内容之一,该函数会将该input内容自动聚焦,方便填写
formaction的适用范围
Internet Explorer 10、Firefox、Opera、Chrome 和 Safari 都支持 formaction 属性。
注意:Internet Explorer 9 及之前的版本不支持 标签的 formaction 属性。