2012-05-24 69 views

回答

4

定義面板像這裏面的容器:

<asp:Panel CssClass="CustomWidth" ID="MyPanel" runat="server"> </asp:Panel> 

然後鏈接到設置下列外部CSS樣式表:

.CustomWidth{  width: 25%; } 
3

您可以使用jQuery爲:

假設Panel1是你的面板的ID,並且,要根據工作的各個內容容器爲Container1

var dWidth = $('#Container1').width(); 
$('#Panel1').width(dWidth * 0.25); 

將設置Panel1寬度爲您使用的容器的25%。

只是決定你想一起工作(可能是一個div或任何類似的,你不告訴我們你的代碼)

-1

我真的不明白你的問題,但它看起來像JavaScript喬布, 例如:

var Element_Id = document.getElementById("Elem_Id"); // Element Id 
var curr_Element_Width = parseInt(Element_Id.clientWidth); // parseInt is taking down our "px" string at the width.... look: 
var curr_Element_Id_Width = 100px we need INT only! 
we only need the number 100 so after parseInt its now 100 and not 100px we can't work with string's and that is the reson we doing that, 

然後你可以使用函數像這樣的......

function addWidth() { 
    Element_Id.style.width = (curr_Element_Width + 100) + 'px'; // after we change the width we add the "px" string again 
} 

在這裏,我們Px的工作,但你可以用%希望它會幫助你,有一個相同美好的一天。

相關問題