利用js有没有办法手动设置DIV宽高等信息呢? 点击确定后修改div的style 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <script type="text/javascript"> <!-- function chgbig(){ var divobj = document.getElementById("div1"); divobj.style.width = parseInt(divobj.style.width)+10; divobj.style.height = parseInt(divobj.style.height)+10; } //--> </script> </head> <body> <button onclick="chgbig()">变大</button> <div id="div1" style="border:1px black solid;background-color:#cfcfcf;width:300px;height:300px"> </div> </body></html> <style>#div1{height:100px;width:100px;background-color:yellow} </style><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script type="text/javascript"> $(function(){ $("#abv").click(function(){ $("#div1").height($("#hei").val()).width($("#wid").val()); }); })</script> <div id="div1"></div>宽<input type="text" id="wid"/>高<input type="text" id="hei"/><input type="button" id="abv" value="确定"/> 多谢.已经成功做出来更改.还有些原理性的东西请教.现在做出的更改,刷新浏览器style就没有了.是不是需要用到程序asp.php这样的语言?才能彻底改变.css文件?呢. 刷新必然样式重置,想要保存样式不一定非得借助后端语言,可以把状态存入cookie中(jquery提供该插件)或者localstorage中,方法自己百度一下,满意的话请结贴吧。多谢.已经成功做出来更改.还有些原理性的东西请教.现在做出的更改,刷新浏览器style就没有了.是不是需要用到程序asp.php这样的语言?才能彻底改变.css文件?呢. jquery 替换元素后出错,是怎么回事 PHP关于时间的问题 请问下面的效果国栏怎么做? 如何避免IE浏览器加载图片时,不影响同页面其他操作 一个子页面按钮怎么刷新父页面中的iframe啊 高手指点,当我把鼠标指向某些文字的时候能列出一个菜单,之后通过点击这个菜单上文字就能超连到相应页面,大家帮帮忙,老师给的课题,不会郁 双击图片,弹出保存图片的对话框,怎么做? 提交表单的小问题,如何在提交表单时弹出一个对话框,提示是否提交。 window.open的问题,急,在线等! 菜鸟提问,大侠帮助! 这样会导致内存泄露吗? 请教一个正则表达式的问题
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script type="text/javascript">
<!--
function chgbig(){
var divobj = document.getElementById("div1");
divobj.style.width = parseInt(divobj.style.width)+10;
divobj.style.height = parseInt(divobj.style.height)+10;
}
//-->
</script>
</head> <body>
<button onclick="chgbig()">变大</button>
<div id="div1" style="border:1px black solid;background-color:#cfcfcf;width:300px;height:300px">
</div>
</body>
</html>
<style>
#div1{height:100px;width:100px;background-color:yellow}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#abv").click(function(){
$("#div1").height($("#hei").val()).width($("#wid").val());
});
})
</script>
<div id="div1"></div>
宽<input type="text" id="wid"/>
高<input type="text" id="hei"/>
<input type="button" id="abv" value="确定"/>
多谢.已经成功做出来更改.还有些原理性的东西请教.
现在做出的更改,刷新浏览器style就没有了.是不是需要用到程序asp.php这样的语言?才能彻底改变.css文件?呢.
多谢.已经成功做出来更改.还有些原理性的东西请教.
现在做出的更改,刷新浏览器style就没有了.是不是需要用到程序asp.php这样的语言?才能彻底改变.css文件?呢.