
1,设置或获取对象指定的文件名或路径。
alert(windowlocationpathname)
2,设置或获取整个 URL 为字符串。
alert(windowlocationhref);
3,设置或获取与 URL 关联的端口号码。
alert(windowlocationport)
4,设置或获取 URL 的协议部分。
alert(windowlocationprotocol)
5,设置或获取 href 属性中在井号“#”后面的分段。
alert(windowlocationhash)
6,设置或获取 location 或 URL 的 hostname 和 port 号码。
alert(windowlocationhost)
7,设置或获取 href 属性中跟在问号后面的部分。
alert(windowlocationsearch)
8,获取变量的值(截取等号后面的部分)
var url = windowlocationsearch;
var loc = urlsubstring(urllastIndexOf(‘=’)+1, urllength);
9,用来得到当前网页的域名
var domain = documentdomain;
<style type="text/css">
file-box{ position:relative;width:340px}
txt{ height:22px; border:1px solid #cdcdcd; width:200px;border-right:none;}
btn{ background-color:#FFF; border:1px solid #CDCDCD;height:26px; width:70px;}
file{ position:absolute; top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px }
</style>
<div class="file-box">
<form action="" method="post" enctype="multipart/form-data">
<input type='text' name='textfield' id='textfield' class='txt' /><input type='button' class='btn' value='浏览' />
<input type="file" name="fileField" class="file" id="fileField" size="28" onchange="documentgetElementById('textfield')value=thisvalue" />
</form>
</div>
要这样写才是对的
做上传当然需要知道文件的位置首先在你上传的jsp页面需要有一个表单form在这个表单里有一个这样一个标签在你点上传按钮的时候将你选中的文件传递到servlet或action这样的处理页面在处理页面StringfileName=requestgetParameter("fileName")这样就得到了文件名。然后你就可以使用文件流对这个文件进行上传 *** 作。如果还有问题直接HI我。
以上就是关于怎么才能得到当前html的地址,实现浏览次全部的内容,包括:怎么才能得到当前html的地址,实现浏览次、html怎么input获取路径、jsp或html如何通过input file 控件获取上传文件的完整路径等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)