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[i]+"',";
}
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[index];
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>