有条件的网址 [英] conditional url
本文介绍了有条件的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i想知道我如何评估当前网址,以便javascript :history.go(-1)''或者javascript :执行history.go(-2)。我希望javascript :history.go(-2)执行,如果网址后缀为#top...就像 http://localhost...#top 。我目前有:
展开 | 选择 | Wrap | 行号
解决方案
测试window.location.hash属性。 ( MDC?window.location )
现在我有:
展开 | 选择 | Wrap | 行号
首先,window.location是一个对象,不是一个字符串。其次,第18行(缺少括号)中存在语法错误,第12行可能是错误的运算符。第三,javascript应该在< script>中使用类型声明提供。标签
hi,
i would like to know how i can evaluate the current url so that either javascript:history.go(-1)''or javascript:history.go(-2) is executed. I would like for the javascript:history.go(-2) to be executed if the url is suffixed with the "#top"... like http://localhost...#top. I currently have:
Expand|Select|Wrap|Line Numbers解决方案test for the window.location.hash property. (MDC ? window.location)
now i have:
Expand|Select|Wrap|Line Numbers
firstly, window.location is an object, not a string. secondly, there''s a syntax error in line 18 (missing brackets) and probably the wrong operator on line 12. thirdly, javascript should be served with a type declaration in the <script> tag.
这篇关于有条件的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆