我试图找出如何通过javascript或jquery设置html5类型输入的最大值和最小值.
<input type="number" max="???" min="???" step="0.5"/>
Run Code Online (Sandbox Code Playgroud)
有人请指导
我在页面中加载iframe,iframe的内容长度会不时更改.我已经实现了以下解决方案.但是高度是固定的,因为dyniframesize只在iframe.onload时调用.
可以相应地调整iframe的大小,以便iframe的高度发生变化吗?
<iframe src ="popup.html" frameborder="0" marginheight="0" marginwidth="0" frameborder="0" scrolling="auto" id="ifm" name="ifm" onload="javascript:dyniframesize('ifm');" width="100%"></iframe>
function dyniframesize(down) {
var pTar = null;
if (document.getElementById){
pTar = document.getElementById(down);
}
else{
eval('pTar = ' + down + ';');
}
if (pTar && !window.opera){
//begin resizing iframe
pTar.style.display="block"
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
//ns6 syntax
pTar.height = pTar.contentDocument.body.offsetHeight +20;
pTar.width = pTar.contentDocument.body.scrollWidth+20;
}
else if (pTar.Document && pTar.Document.body.scrollHeight){
//ie5+ syntax
pTar.height = pTar.Document.body.scrollHeight;
pTar.width = pTar.Document.body.scrollWidth;
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)