1. 下面的代碼演示了如何在服務端獲取來自客戶端瀏覽器中某一個圖片的x,y坐標,注意input控件的類型是image類型。 <form> <Input Name="ImageMap" Type="Image" Src="http://www.okasp.com/techinfo/ImageMap.jpg" Alt="Click Anywhere"> </form> <%ImageMap.x = <%=Request("ImageMap.x") ImageMap.y = <%=Request("ImageMap.y")%> 2. 利用ADODB.Stream對象,在IE瀏覽器中下載服務端上的各類文件。 即直接提示用戶下載而不是由瀏覽器打開某些文件。注意,下面的代碼拷貝到ASP文件中后,不要再添加一些非ASP代碼在頁面中:如HTML和Javascript客戶端的代碼。 <% '-------------------------------------------- Response.Buffer = True Dim strFilePath, strFileSize, strFileName Const adTypeBinary = 1strFilePath = "文件路徑 " strFileSize = ... 文件大小,可選 strFileName = "文件名"Response.Clear'8*******************************************8 ' 需要在你的服務器上安裝 MDAC 2.6 或MDAC2.7 '8*******************************************8 Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile strFilePathstrFileType = lcase(Right(strFileName, 4)) '文件擴展名' 通過文件擴展名判斷 Content-Types Select Case strFileType Case ".asf" ContentType = "video/x-ms-asf" Case ".avi" ContentType = "video/avi" Case ".doc" ContentType = "application/msword" Case ".zip" ContentType = "application/zip" Case ".xls" ContentType = "application/vnd.ms-excel" Case ".gif" ContentType = "image/gif"(出處:pconline)
|