Javascript 如何调整大小<;部门>;在<;部门>;

Javascript 如何调整大小<;部门>;在<;部门>;,javascript,jquery,html,resize,flextable,Javascript,Jquery,Html,Resize,Flextable,html数据 <div id="flexdiv" class="resizable-ui"> <div> etc layer .. </div> <table class='flexme1'> ... </table> </div> 它不起作用 我不知道是什么问题 帮帮我!天使们!!!!!!!!!!!!!!!plz..因此我编写了代码,您可以在其中调整div和table元素的大小: <div id="flexdi

html数据

<div id="flexdiv" class="resizable-ui">
<div> etc layer .. </div>

<table class='flexme1'>
...
</table>

</div>
它不起作用 我不知道是什么问题
帮帮我!天使们!!!!!!!!!!!!!!!plz..

因此我编写了代码,您可以在其中调整div和table元素的大小:

<div id="flexdiv" class="resizable-ui" style="border: 1px solid">
<div> etc layer .. </div>

<table id="table1" class='flexme1' style="border: 2px dotted; width:200px; height:200px">
</table>

</div>
我已经在变量中放置了新的宽度和高度,您可以根据您的需要进行更改,希望您能够了解如何进行更改。您也可以根据div的大小制作表,基本内核将与我提供给您的相同


您希望在这里实现什么目标?有两个div元素,您想调整哪一个,何时调整?这里一个明显的问题是,您使用的div变量没有任何内容,因此代码不会超出该行!因此,您应该首先编写以下代码:var div=document.getElementById(“flexdiv”);我检查过了,现在你会得到宽度:501和高度40!当您从高度调整到100时,它给出了-60I wnat以调整“”元素的大小,这也会改变大小“”。因此,是否要调整flexdiv的大小,然后将表flexme1 20的高度设置为小于flexdiv的高度?确定,请稍候。。我会修好的
<div id="flexdiv" class="resizable-ui" style="border: 1px solid">
<div> etc layer .. </div>

<table id="table1" class='flexme1' style="border: 2px dotted; width:200px; height:200px">
</table>

</div>
var div = document.getElementById("flexdiv");
var width = $(div).width(),
height = $(div).height();

alert("Div-OldHeight: "+ height);
alert("Div-OldWidth: "+ width);
var newHeight = "600px";
var newWidth = "400px";
div.style.height = newHeight;
div.style.width = newWidth;
alert("Div-NewHeight: "+ newHeight);
alert("Div-NewWidth: "+ newWidth);

var table = document.getElementById("table1");
width = $(table).width(),
height = $(table).height();

alert("Table-OldHeight: "+ height);
alert("Table-OldWidth: "+ width);
var newHeight = "100px";
var newWidth = "100px";
table.style.height = newHeight;
table.style.width = newWidth;
alert("Table-NewHeight: "+ newHeight);
alert("Table-NewWidth: "+ newWidth);