xml 代码
- '0000000.html'为你要打开的网页
- 方法一:
- <HTML XMLNS:MSIE >
- <MSIE:DOWNLOAD ID="oDownload" STYLE="behavior:url(#default#download)" />
- <SCRIPT>
- function onDownloadDone(s) { alert (s); }
- </SCRIPT>
- <P>Click <A HREF="javascript:oDownload.startDownload('0000000.html',
- onDownloadDone)">here</A> to download this page.
- 方法二:
- <script language="JavaScript">
- function onDownloadDone(data) {
- alert(data);
- }
- </script>
- <input type="button" style="behavior:url(#default#download)" value="获得代码" onclick=this.startDownload("0000000.html",onDownloadDone)>
- 方法三:
- <script language="JavaScript">
- function getFileName()
- {
- var url=window.location.href;
- //alert(url);
- var pos=url.lastIndexOf("\\");
- //如果是网上文件,路径分割符为"\\"
- //alert(pos);
- if (pos==-1) //pos==-1表示不是网上文件为本地文件
- pos=url.lastIndexOf("/"); //本地文件路径分割符为"/"
- //alert(pos);
- var fileName=url.substring(pos+1); //从url中获得文件名
- return fileName;
- }
-
- function onDownloadDone(fileName)
- {
- alert(fileName);
- }
- </script>
- <input type="button" id="behaviorID" style="behavior:url(#default#download)"
-
-
- 主要都是用到了behavior:url
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|