ASPX在代码后面设置div属性或javascript。 [英] ASPX set div attribute in code behind or javascript.
问题描述
我有两个div我想动态设置gridViews的大小。我尝试了两种方法,用javascript进行新的尝试。我收到错误,指出''setWidths''不是* .aspx的成员。我的要求是将我用css(.Middle {margin-left:auto; margin-right:auto; position:relative;})尝试过的GridViews居中,这不起作用 - 但div元素确实对此做了很长时间的响应因为它有一个宽度定义。
I have two divs I want to set the width dynamically to the size of the gridViews. I have tried two ways, bit new with javascript. I get error that states ''setWidths'' is not a member of *.aspx. My requirements are to center the GridViews which I have tried with css(.Middle{margin-left:auto;margin-right:auto;position:relative;}) which does not work - however the div element does respond to this as long as it has a width defined.
<script language="javascript" type="text/javascript" >
function setWidths() {
$('divME').width = $('gvME').width;
$('divDE').width = $('gvDE').width;
return;}
</script>
divME.Attributes(Width)= someValue
我缺少什么?
divME.Attributes("Width") = someValue
What am I missing?
推荐答案
('divME')。width =
('divME').width =
( 'gvME')。width;
('gvME').width;
('divDE')。width =
('divDE').width =
这篇关于ASPX在代码后面设置div属性或javascript。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!