帮看下这个代码

来源:百度知道 编辑:UC知道 时间:2024/05/27 05:11:49
response.write"this.location.href='../index.asp',这句话是跳转到index.asp'。可是为什么要"href='../index.asp'"这样写,把“../”去掉就不可以了。为什么呢

"../"是相对路径,意思是当前目录的父目录.

假设response.write"this.location.href='../index.asp'这句代码在A目录下的a.asp文件里.可知道index.asp这个文件跟a目录同在一个目录下.
因此,如果去掉"../"就使代码访问的是a目录下的index.asp,而A目录下肯定没存在此文件,所以去掉就不能访问了.