qinya06 发表于 2013-1-28 13:01:45

数组 查找元素

String[] type={"JPG","jpg","bmp","BMP"};String fileTYpe="BMP";   //前提:这个数组已经排好序,否则没有意义int place=java.util.Arrays.binarySearch(type,fileType);
----------------------------------------
动态添加行
<script type="text/javascript">    function addMore(){    var td = document.getElementById("more");    var br= document.createElement("br");    var input= document.createElement("input");    var button= document.createElement("input");      input.type = "file";    input.name = "file";      button.type = "button";    button.value = "移除...";            button.onclick = function(){      td.removeChild(br);      td.removeChild(input);      td.removeChild(button);    }       td.appendChild(br);    td.appendChild(input);    td.appendChild(button);    }</script>
-------------------------------------------------------------------------------
<%String newAddress="";String[] address=(String[])request.getAttribute("address");for(int i=0;i<address.length;i++){newAddress+="'"+address+"',";}newAddress=newAddress.substring(0,newAddress.length()-1);%>
<SCRIPT language="javascript">//指定要显示的图片路径var sImgArr=new Array(<%=newAddress%>);var plImg = new Image();var gIndex = 0;function SlideImg(index){gIndex = index;if ('Microsoft Internet Explorer' == navigator.appName){document.images["slideImg"].filters.item(0).Apply();}document.images["slideImg"].src = sImgArr;if ('Microsoft Internet Explorer' == navigator.appName){document.images["slideImg"].filters.item(0).play();}}function NextImg(){//显示下一张图片gIndex = ((gIndex+1)>=sImgArr.length?0:(gIndex+1));SlideImg(gIndex);}function PrevImg(){//显示前一张图片gIndex = ((gIndex-1)<0?(sImgArr.length-1):(gIndex-1));SlideImg(gIndex);}var sid;function inislide(){//设置自动运行if(sid==null){sid = setInterval('NextImg()', 3000);}}</SCRIPT>

----------------------------------------------------------------------------
自动转发
<script type="text/javascript">   windows.setTimeout("javascript:document.forms['autoforward'].submit()",3000);</script>
页: [1]
查看完整版本: 数组 查找元素