<script>/* <BR>By Auntion <BR>QQ 82874972 <BR>javascript 및 ajax QQ를 좋아하는 친구를 환영합니다. , 함께 진행해 볼까요 ㅎㅎ<BR>사용 방법<BR>호출 효과: Effect(1,2) <BR> 1은 변경되는 개체의 ID <BR> 2는 컨트롤 컨테이너의 ID입니다. . Use: this.parentNode.id에서 찾을 수 있습니다(상위 태그의 ID) <BR>주어줄 때 객체 ID를 반복하지 않도록 주의하세요. <BR>*/ <BR>함수 $G( Read_Id) { return document.getElementById(Read_Id) } <BR>function Effect(ObjectId,parentId){ <BR> if ($G(ObjectId).style.display == 'none'){ <BR> Start(ObjectId, '열기') <BR> $G( parentId).innerHTML = "<a href=# onClick=javascript:Effect('" ObjectId "','" parentId "');>닫기</a>" <BR> }else{ <BR> 시작(ObjectId,'Close') <BR> $G(parentId).innerHTML = "<a href=# onClick=javascript:Effect('" ObjectId "','" parentId "');>Open< /a>" <BR> } <BR>} <BR>function Start(ObjId,method){ <BR>var BoxHeight = $G(ObjId).offsetHeight; 개체의 최소 높이<BR>var MaxHeight = 130; 객체의 최대 높이 <BR>var BoxAddMax = 1; 속도가 빨라진다] <BR> var Reduce = (BoxAddMax - Every_Add); <BR>var Add = (BoxAddMax Every_Add); <BR>if (method == "Close"){ <BR> var Alter_Close = function(){ //가상 감소 ] 루프 <BR> BoxAddMax /= 감소 <BR> BoxHeight -= BoxAddMax <BR> if (BoxHeight <= MinHeight){ <BR> $G (ObjId).style.display = "none"; window.clearInterval(BoxAction); <BR> } <BR> else $G(ObjId).style.height = BoxHeight; <BR>} <BR>var BoxAction = window.setInterval(Alter_Close,1); <BR>else if (method == "Opens"){ <BR>var Alter_Opens = function(){ //가상 [증가] 루프 구성<BR> BoxAddMax *= Add <BR> BoxHeight = BoxAddMax; > if (BoxHeight >= MaxHeight){ <BR> $G(ObjId).style.height = MaxHeight; <BR> window.clear Interval(BoxAction) <BR> }else{ <BR> $G(ObjId) .style.display= "block"; <BR> $G(ObjId).style.height = BoxHeight; <BR> } <BR>} <BR> var BoxAction = window.setInterval(Alter_Opens,1); } <BR>} <BR></script>
<본문>
하나 열려 있고 다른 하나는 닫혀 있습니다.
<script>
/*
By Auntion
QQ 82874972
使用方法
调用效果: Effect(1,2);
其中1为: 被改变对象的id
其中2为: 控制容器的id 可在使用: this.parentNode.id 取得(父标签的id)
注意给对象ID的时候一定不要重复.
*/
function $G(Read_Id) { return document.getElementById(Read_Id) }
function Effect(ObjectId,parentId){
if ($G(ObjectId).style.display == 'none'){
Start(ObjectId,'Opens');
$G(parentId).innerHTML = "<a href=# onClick=javascript:Effect('"+ObjectId+"','"+parentId+"');>关闭"
}else{
Start(ObjectId,'Close');
$G(parentId).innerHTML = "<a href=# onClick=javascript:Effect('"+ObjectId+"','"+parentId+"');>打开"
}
}
function Start(ObjId,method){
var BoxHeight = $G(ObjId).offsetHeight; //获取对象高度
var MinHeight = 5; //定义对象最小高度
var MaxHeight = 130; //定义对象最大高度
var BoxAddMax = 1; //递增量初始值
var Every_Add = 0.15; //每次的递(减)增量 [数值越大速度越快]
var Reduce = (BoxAddMax - Every_Add);
var Add = (BoxAddMax + Every_Add);
if (method == "Close"){
var Alter_Close = function(){ //构建一个虚拟的[递减]循环
BoxAddMax /= Reduce;
BoxHeight -= BoxAddMax;
if (BoxHeight <= MinHeight){
$G(ObjId).style.display = "none";
window.clearInterval(BoxAction);
}
else $G(ObjId).style.height = BoxHeight;
}
var BoxAction = window.setInterval(Alter_Close,1);
}
else if (method == "Opens"){
var Alter_Opens = function(){ //构建一个虚拟的[递增]循环
BoxAddMax *= Add;
BoxHeight += BoxAddMax;
if (BoxHeight >= MaxHeight){
$G(ObjId).style.height = MaxHeight;
window.clearInterval(BoxAction);
}else{
$G(ObjId).style.display= "block";
$G(ObjId).style.height = BoxHeight;
}
}
var BoxAction = window.setInterval(Alter_Opens,1);
}
}
</script>
<script>
/*
By Auntion
QQ 82874972
使用方法
调用效果: Effect(1,2);
其中1为: 被改变对象的id
其中2为: 控制容器的id 可在使用: this.parentNode.id 取得(父标签的id)
注意给对象ID的时候一定不要重复.
*/
function $G(Read_Id) { return document.getElementById(Read_Id) }
function Effect(ObjectId,parentId){
var Obj_Display = $G(ObjectId).style.display;
if (Obj_Display == 'none'){
Start(ObjectId,'Opens');
$G(parentId).innerHTML = "<a href=# onClick=javascript:Effect('"+ObjectId+"','"+parentId+"');>关闭"
}else{
Start(ObjectId,'Close');
$G(parentId).innerHTML = "<a href=# onClick=javascript:Effect('"+ObjectId+"','"+parentId+"');>打开"
}
}
function Start(ObjId,method){
var BoxHeight = $G(ObjId).offsetHeight; //获取对象高度
var MinHeight = 5; //定义对象最小高度
var MaxHeight = 130; //定义对象最大高度
var BoxAddMax = 1; //递增量初始值
var Every_Add = 0.15; //每次的递(减)增量 [数值越大速度越快]
var Reduce = (BoxAddMax - Every_Add);
var Add = (BoxAddMax + Every_Add);
//关闭动作**************************************
if (method == "Close"){
var Alter_Close = function(){ //构建一个虚拟的[递减]循环
BoxAddMax /= Reduce;
BoxHeight -= BoxAddMax;
if (BoxHeight <= MinHeight){
$G(ObjId).style.display = "none";
window.clearInterval(BoxAction);
}
else $G(ObjId).style.height = BoxHeight;
}
var BoxAction = window.setInterval(Alter_Close,1);
}
//打开动作**************************************
else if (method == "Opens"){
var Alter_Opens = function(){
BoxAddMax *= Add;
BoxHeight += BoxAddMax;
if (BoxHeight >= MaxHeight){
$G(ObjId).style.height = MaxHeight;
window.clearInterval(BoxAction);
}else{
$G(ObjId).style.display= "block";
$G(ObjId).style.height = BoxHeight;
}
}
var BoxAction = window.setInterval(Alter_Opens,1);
}
}
</script>