有两种获取链接文件名的方法:
第一种:从连接URL,从描述中获取
第二种:如果第一种获取不到,可以从URL地址中获取
比如这种地址:
>
就用你说的方法,我写的例子如下:
<form>
<input type=text name=xxx><input type=submit>
</form>
<script language=javascript>
documentwriteln(locationhref,'<br>');
var s=locationhref;
s=sreplace(/\$/,'')
s=sreplace(/^\//,'')
documentwriteln(s,'<br>');
</script>
设置或获取对象指定的文件名或路径。
<script>
alert(windowlocationpathname)
</script>
设置或获取整个 URL 为字符串。
<script>
alert(windowlocationhref);
</script>
设置或获取与 URL 关联的端口号码。
<script>
alert(windowlocationport)
</script>
设置或获取 URL 的协议部分。
<script>
alert(windowlocationprotocol)
</script>
<script>
alert(windowlocationhash)
</script>
设置或获取 location 或 URL 的 hostname 和 port 号码。
<script>
alert(windowlocationhost)
</script>
设置或获取 href 属性中跟在问号后面的部分。
<script>
alert(windowlocationsearch)
</script>
设置或获取对象指定的文件名或路径。
<script>
alert(windowlocationpathname)
</script>
设置或获取整个
URL
为字符串。
<script>
alert(windowlocationhref);
</script>
设置或获取与
URL
关联的端口号码。
<script>
alert(windowlocationport)
</script>
设置或获取
URL
的协议部分。
<script>
alert(windowlocationprotocol)
</script>
设置或获取
href
属性中在井号“#”后面的分段。
<script>
alert(windowlocationhash)
</script>
设置或获取
location
或
URL
的
hostname
和
port
号码。
<script>
alert(windowlocationhost)
</script>
设置或获取
href
属性中跟在问号后面的部分。
<script>
alert(windowlocationsearch)
</script>
以上就是关于java 获得http下载文件的真实名称全部的内容,包括:java 获得http下载文件的真实名称、[闲聊]如何快速把url和文件名互相转换、如何利用Js获取当前地址的文件名并做相应 *** 作啊等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)