window.location = 'http://...';
现在我想将此位置路径分配给一个变量,作为一个普通的文本字符串。
我想实现:
var Path = 'http://...';
我尝试使用:
var Path = window.location;
但我明白了,因为这个 var 值:
function Path() { [native code] }
而我想将位置文本字符串作为其值..
最佳答案
你要location.href
. location
object 比简单的字符串要复杂得多。
关于Javascript echo window.location,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6163163/