1.点击后隐藏或显示下几层信息
- <html>
- <head>
- <style type="text/css">
- div { width:400px; height:25px; border:1px solid #000000; cursor:pointer;}
- </style>
- <script>
- function test(obj)
- {
- var displayname;
- objobj=obj.nextSibling;
- if(obj.id!="two"){
- if(obj.style.display=="none"){
- obj.style.display="block";
- }else{
- obj.style.display="none";
- }
- displayname=obj.style.display;
- }
- if(displayname=null) return;
- while(obj.nextSibling.id!="two"){
- objobj=obj.nextSibling;
- obj.style.display=displayname;
- }
- }
- </script>
- </head>
- <body>
- <div onclick="test(this)">第一层</div>
- <div onclick="test(this)">第二层</div>
- <div onclick="test(this)">第三层</div>
- <div onclick="test(this)">第四层</div>
- <div onclick="test(this)">第五层</div>
- <div onclick="test(this)">第六层</div>
- <div onclick="test(this)">第七层</div>
- <div id="two">根目录二</div>
- </body>
- </html>
2.A,B,C,...,Z,AA,AB,AC,....AZ,BA,BB,...,ZZ,AAA,AAB,AAC,...,AAZ,ABA,ABB,ABC,...ABZ,....AZZ.....
写一个function print(start,count)函数
start 是开始位置 count是输出的个数
如print(2,3)
输出就是 B,C,D
26进制
- <html>
- <head>
- <script>
- function println(start,count)
- {
- var s='';
- for(var i=0;i<count;i++){
- s+=getChar(start+i);
- if(i!=count-1) s+=',';
- }
- alert(s);
- }
- function getChar(n){
- var s='ABCDEFGHIGHLMNOPQRSTUVWXYZ';
- var i='';
- if(n<26){
- return s.substr(n,1);
- }else{
- i+=getChar(n/26-1,1);
- i+=getChar(n%26-1,1);
- return i;
- }
- }
- </script>
- </head>
- <body>
- <input type="button" value="确定" onclick="println(1134,3)" />
- </body>
- </html>