草庐IT

wifi_locations

全部标签

javascript - 在帧中设置 location.hash

我正在使用ajax更新框架中页面的位置。但是当设置散列的位置时(特别是在Chrome和某些版本的IE(5.5)上,但偶尔在IE7上)页面正在重新加载。下面的html演示了这个问题。主框架....frame.html是sethash.html页面是.varCount=0;functionsethash(){top.document.location.hash="hash"+Count;Count++;}Hello`在大多数浏览器上加载frame.html将在页面加载时显示一次加载警报。然后当按下设置哈希按钮时,url将被更改,但加载的警报的哈希将不会再次显示。在chrome和某些版本的I

javascript - 如何在JavaScript中改变window.location.href然后执行更多的JS?

我有代码片段,它是在点击如下链接时执行的cj_redirecturl="/HomeWork/main/load_course";utility.xhttprw.data(cj_redirecturl,{data:courseid},function(response){if(response){window.location.href=base_url+"main";///nextutility.xhttprw.data(redirecturl,{data:""},function(response){if(response){id=ent;document.getElementByI

javascript - 为什么 window.location 追加而不是替换 ie 中的 URL

我在ie中收到错误的URL,但在firefox和chrome中却没有。基本上,我有一个名为文本搜索的文本字段。我在htaccess中使用jQuery和rewriterule来内部重定向页面。我在本地主机上,所有文件都在一个名为test的文件夹中。在firefox和chrome中,如果您在文本搜索框中输入“你好”按回车键、“嗨”按回车键和“再见”按回车键,您将获得正确的URL作为本地主机/测试/测试/你好和本地主机/测试/测试/嗨和本地主机/测试/测试/再见分别。在即你得到本地主机/测试/测试/你好和本地主机/测试/测试/测试/嗨和本地主机/测试/测试/测试/测试/再见分别这里的问题是“

javascript - 为什么 window.location.search 是空的?

如果我console.log(window.location)我得到这个:Location{replace:function,assign:function,ancestorOrigins:DOMStringList,origin:"https://localhost:3000",hash:"#/account/content?hello=world"…}ancestorOrigins:DOMStringListassign:function(){[nativecode]}hash:"#/account/content?hello=world"host:"localhost:3000"

没有 www 的 Javascript location.host

我有一个php文件,用于在Facebook和Twitter上分享我的用户的帖子。例如,如果我点击Twitter图标,我会看到一个屏幕,其中自动写入了指向我网站的超链接。这很好,但我想删除自动显示在Twitter屏幕上的url的www.部分。我猜这与location.host有关,所以我用google搜索,但找不到这个问题的正确答案。这是我的代码示例:functione(f,i,an){with(document){write('');write(' ');write('');write('');write('(#'+i+')');document.write(' '

javascript - window.location.indexOf 在 Javascript 中不起作用

下面是我的。varmyString="http://localhost:8888/www.smart-kw.com/";alert(myString.indexOf("localhost"));这会提醒我...但是如果我将varmyString="http://localhost:8888/www.smart-kw.com/";更改为varmyString=window.location;,它不起作用(我没有收到警报)。varmyString=window.location;alert(myString.indexOf("localhost")); 最佳答案

javascript - 如何使用 window.location 获取子域?

如果我有一个主机名,例如:http://sample.example.com在Javascript中,我执行window.location.hostname,我会得到“example.com”还是“sample.example.com”?如果没有,我怎么能得到sample.example.com? 最佳答案 是的,window.location.hostname也会为您提供子域。如果这不起作用,或者某些其他浏览器不支持,您可以很容易地解析它://window.location.href=="http://sample.somedom

javascript - history.back() 不会在 Chrome/FireFox 中更新 location.hash

我尝试构建一个JS脚本来更改页面的位置,然后返回直到找到特定的哈希位置:varStopAtThisHash='#';varCurrentHash=window.location.hash;varcontinueLoop=true;while((window.history.length>0)&&(continueLoop)){window.history.back();varNowWeAreAtHash=window.location.hash;//thisneverchangesinChrome//actually,alwaysseemsto:CurrentHash==NowWeAr

javascript - window.location.reload 后转到 anchor 链接

我正在尝试更新哈希,然后重新加载页面。$('a[name="'+fragment+'"]').remove();//don'tjumpbeforewindowreloadswindow.location.hash=fragment;window.location.reload(true);重新加载窗口后不会跳转到anchor标记。我该如何解决? 最佳答案 如果您要重新加载页面,这在jQuery中实现起来相当简单。加载页面时只需检查window.location.hash属性即可。$(document).ready(function(

javascript - window.location.hash 总是显示为空

在我的phonegap应用程序中,我更新了我的数据,因为我有以下代码,因为我得到了window.location.hash(*指示错误行)值将为空。functioninit(){$("#homePage").live("pageshow",function(){getDatas();});$("#editPage").live("pageshow",function(){***varloc=window.location.hash;***alert("loc"+loc);if(loc.indexOf("?")>=0){varqs=loc.substr(loc.indexOf("?")+