Home > Web Front-end > JS Tutorial > JavaScript sets FieldSet expansion and contraction_javascript skills

JavaScript sets FieldSet expansion and contraction_javascript skills

WBOY
Release: 2016-05-16 18:53:08
Original
1757 people have browsed it
JavaScript method code:
Copy code The code is as follows:

// Set the FieldSet height method, support IE browser, Firefox
// Parameter 1: pTableID, the id of the div or table inside the FieldSet
// Parameter 2: pFieldSetID, the ID of the FieldSet
// Parameter 3: pImageID , the ID of the picture, update the picture SRC after expanding or shrinking
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" ;
}
}

FieldSet code in HTML :
Copy code The code is as follows:



Expand or collapseTravel and ship arrival record(Entered/Not entered)< /span>

style="visibility: visible; " style="visibility: visible;">







Vehicle and vessel name: A total of 50 cars and wagons

Arrival time of cars and ships: 17:00 on May 9, 2009
< ;/td>

How to get coal:Railway

Coal source: Huainan


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template