JavaScript方法代码:
// 设置FieldSet高度方法,支持IE浏览器、Firefox
// 参数1:pTableID,FieldSet内部div或table的id
// 参数2:pFieldSetID,FieldSet的ID
// 参数3:pImageID,图片的ID,展开或收缩后更新图片SRC
function FieldSetVisual( pTableID, pFieldSetID, pImageID )
{
var objTable = document.getElementById( pTableID ) ;
var objFieldSet = document.getElementById( pFieldSetID) ;
var objImage = document.getElementById( pImageID) ;
if( objTable.style.visibility == 'visible' )
{
objTable.style.visibility = 'hidden' ;
objFieldSet.style.height = "22px" ;
objImage.src="images/expand.png" ;
}
else
{
objTable.style.visibility = 'visible';
var heightFieldSet = parseInt( objFieldSet.style.height.substr(0,objFieldSet.style.height.length-2)) ;
var heightTable = parseInt( objTable.offsetHeight ) ;
objFieldSet.style.height = heightFieldSet + heightTable + "px" ;
objImage.src="images/constringency.png" ;
}
}
HTML中FieldSet代码: