20
Sep
[置顶] 拒绝日货 爱国终极演讲
11
Jan
直接上代码
h5中新增的 formaction属性,
带有两个提交按钮的表单(不同的 action 值):
<script language="javascript">
function chaxun(){
document.MyForm.action="#";
document.MyForm.submit();
}
function daochu(){
document.forms.MyForm.action="daochu.php";
document.forms.MyForm.submit();
}
</script>
<form method="post" id="MyForm">
<input type="button" name="btn1" value="查询" onclick="chaxun();">
<input type="button" name="btn2" value="导出" onclick="daochu();">
</form>
function chaxun(){
document.MyForm.action="#";
document.MyForm.submit();
}
function daochu(){
document.forms.MyForm.action="daochu.php";
document.forms.MyForm.submit();
}
</script>
<form method="post" id="MyForm">
<input type="button" name="btn1" value="查询" onclick="chaxun();">
<input type="button" name="btn2" value="导出" onclick="daochu();">
</form>
h5中新增的 formaction属性,
带有两个提交按钮的表单(不同的 action 值):
<form action="demo_form.php" method="post">
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
<input type="submit" value="Submit" /><br />
<input type="submit" formaction="demo_admin.php" value="系统管理" />
</form>
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
<input type="submit" value="Submit" /><br />
<input type="submit" formaction="demo_admin.php" value="系统管理" />
</form>
26
Dec
Target.Address 返回的是文本型式。
Target.Address = Cells(4, 2).Address【更适配合match函数写动态单元格地址】
或
Target.Address = “$B$4”
Target.Address = Cells(4, 2).Address【更适配合match函数写动态单元格地址】
或
Target.Address = “$B$4”
8
Dec
18
Nov
JS自适应高度,其实就是设置iframe的高度,使其等于内嵌网页的高度,从而看不出来滚动条和嵌套痕迹。对于用户体验和网站美观起着重要作用。
如果内容是固定的,那么我们可以通过CSS来给它直接定义一个高度,同样可以实现上面的需求。当内容是未知或者是变化的时候。这个时候又有几种情况了。
iframe内容未知,高度可预测
这个时候,我们可以给它添加一个默认的CSS的min-height值,然后同时使用JavaScript改变高度。常用的兼容代码有:
......
内容宽度变化的iframe高度自适应
如果内容是固定的,那么我们可以通过CSS来给它直接定义一个高度,同样可以实现上面的需求。当内容是未知或者是变化的时候。这个时候又有几种情况了。
iframe内容未知,高度可预测
这个时候,我们可以给它添加一个默认的CSS的min-height值,然后同时使用JavaScript改变高度。常用的兼容代码有:
// document.domain = "caibaojian.com";
function setIframeHeight(iframe) {
if (iframe) {
var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
if (iframeWin.document.body) {
iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
}
}
};
window.onload = function () {
setIframeHeight(document.getElementById('external-frame'));
};
function setIframeHeight(iframe) {
if (iframe) {
var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
if (iframeWin.document.body) {
iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
}
}
};
window.onload = function () {
setIframeHeight(document.getElementById('external-frame'));
};
......
内容宽度变化的iframe高度自适应