Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptʵÏÖ¶ÔÎļþÉÏ´«ÀàÐ͵ÄÏÞÖÆ

×¢£º http://www.java114.com/277/content4355.html
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> upload </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<FORM ACTION="load.jsp" METHOD="POST" ENCTYPE="mutipart/form-data" name="myform">
 ÇëÑ¡ÔñÉÏ´«Îļþ£º<INPUT TYPE="file" NAME="picture"/>
<INPUT TYPE="button" value="Ìá ½»" onclick="check(myform);"/>
<INPUT TYPE="button" value="È¡ Ïû" onclick="window.close();"/>
</FORM>
</BODY>
</HTML>
<script language="javascript">
function isEmpty(str){
 for(var i=0;i<str.length;i++){
  if(str.charAt(i)!==" "){
    return false;
  }
 }
 return true;
}
function check(form){
 var fileName = form.picture.value;
 if(isEmpty(fileName)){
    alert("ÇëÑ¡ÔñÎļþÃû");
    form.picture.focus();
    return false;
 }
 //lastIndexOfÈç¹ûûÓÐËÑË÷µ½Ôò·µ»ØÎª-1
    if(fileName.lastIndexOf(".")!=-1)
 {
    var fileType = (fileName.substring(fileName.lastIndexOf(".")+1,fileName.length)).toLowerCase();
       var suppotFile = new Array();
    suppotFile[0] = "gif";
    suppotFile[1] = "bmp";
    suppotFile[2] = "jpg";
    for(var i =0;i<suppotFile.length;i++){
       if(suppotFile[i]==fileType){
     return true;
    }else{
   continue;
    }
  }
  alert("²»Ö§³ÖÎļþÀàÐÍ"+fileType);
  return false;
 }else
 {
  alert("ÎļþÖ»Ö§³ÖJIF£¬BMP£


Ïà¹ØÎĵµ£º

¹ö¶¯Í¼Æ¬Çл»Á¬²¥(JavaScriptÌØÐ§ | JSÌØÐ§Ô´´úÂë)

·ûºÏ XHTML 1.0 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> ......

javascriptѧϰÐĵÃ(2)

ÄÚ²¿Êý×é
ÔÚJavaÖÐΪÁË·½±ãÄÚ²¿¶ÔÏóµÄ²Ù×÷,¿ÉÒÔʹÓô°Ìå(Forms)¡¢¿ò¼Ü(Frames)¡¢ÔªËØ(element)¡¢Á´½Ó(links)ºÍê(Anchors)Êý×éʵÏÖ¶ÔÏóµÄ·ÃÎÊ¡£
¡¡anchors[]:ʹÓá¶A name=“anchorName“¡·±êʶÀ´½¨Á¢ÃªµÄÁ´½Ó¡£
¡¡links[]: ʹÓÃ<A href=”URL”>À´¶¨ÒåÒ»¸öÔ½Îı¾Á´½ÓÏî¡£
¡¡Forms[]: ÔÚ³ÌÐò ......

107Ìõjavascript³£ÓÃÓï¾ä

1. document.write( " "); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document- >html- >(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window- >(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËØµÄÃû³ÆºÍÖµ:document.getElementById( "±íµ¥ÖÐÔªËØµÄID號 ").name(»òvalu ......

JavaScriptÖÐ µÄµ¹¼ÆÊ±

<html>
<head>
<title></title>
</head>
<body>
<form id=aa name=aa>
<input type=button value="ͬÒâ(10)" id=a1 disabled="disabled">
</form>
</body>
</html>
<script>
var num=10;
window.setTimeout("aa()",1000);
function ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ