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£
Ïà¹ØÎĵµ£º
ͨ¹ýÇëÇóµÄheaderÖпÉÒÔ¿´µ½ User-Agent Ïî
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0; CIBA)
ÕâÀï¼Ç¼Á˱¾µØÐÅÏ¢£¬Í¨¹ýÕâÀïµÄ.Net CLR xxxxx£¬¿ÉÒÔÅÐ¶Ï ......
public static void Main()
{
WebRequest req = WebRequest.Create("http://blog.csdn.net/xiaofengsheng");
try
& ......
·ûºÏ 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" /> ......
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ÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«Öµ
ÖÚËùÖÜÖªwindow.open() º¯Êý¿ÉÒÔÓÃÀ´´ò¿ªÒ»¸öд°¿Ú£¬ÄÇôÈçºÎÔÚ×Ó´°ÌåÖÐÏò¸¸´°Ì崫ֵĨ£¬Æäʵͨ¹ýwindow.opener¼´¿É»ñÈ¡¸¸´°ÌåµÄÒýÓá£
ÈçÎÒÃÇн¨´°ÌåFatherPage.htm:
XML-Code:
<script type="text/javascript">
function OpenChildWindow()
{ ......