Function of a table contraction expansion

xiaoxiao2021-03-06  40

Function fnshowhide () {

Obj = window.event.srcelement

Obj.src = (Obj.Src.indexof ("close_w")! = - 1)? "/ image / open_w.gif": "/ image / close_w.gif";

While (Obj.tagname! = "TR") {

Obj = obj.parentelement

}

While (Obj = obj.nextsibling) {

Obj.style.display = (obj.style.display == ")?" NONE ":" "

}

}

Use description:

A form

Two lines

The first line has a " , -" icon, " " indicates the line harvest after the line, "-" means expansion

The function is triggered when I icon OnClick.

It turned out that I used a 20-line code when I wrote this function. Now I am 8 lines. I originally implemented it in the future. Now it is a loop iteration. Note The optimization of code is endless, maybe I am really weak when I write 20 lines, maybe now I don't want to go, but I am sure, that is, I am progressing. Finally, I want to say: Don't be in the current achievement, and it is endless.

转载请注明原文地址:https://www.9cbs.com/read-73586.html

New Post(0)