String is not a function on window location href

This question already has an answer here: How do I redirect to another webpage? 67 answers Try- window.location.href = link; or window.location.assign(link); JSFiddle Check out the syntax of window.location here. Try using: window.location.href = link; MDN source window.location.href = link; 用这个。

字符串不是窗口位置href上的函数

这个问题在这里已经有了答案: 我如何重定向到另一个网页? 67个答案 尝试- window.location.href = link; 要么 window.location.assign(link); 的jsfiddle 在这里查看window.location的语法。 尝试使用: window.location.href = link; MDN来源 window.location.href = link; 用这个。

How to make a page redirect using JavaScript?

This question already has an answer here: How do I redirect to another webpage? 67 answers Use: window.location = "http://my.url.here"; Here's some quick-n-dirty code that uses jQuery to do what you want. I highly recommend using jQuery. It'll make things a lot more easier for you, especially since you're new to JavaScript. <select id = "pricingOptions" name = "pricingOpt

如何使用JavaScript进行页面重定向?

这个问题在这里已经有了答案: 我如何重定向到另一个网页? 67个答案 使用: window.location = "http://my.url.here"; 这里有一些使用jQuery来做你想做的快速n-dirty代码。 我强烈建议使用jQuery。 它会让事情变得更容易,特别是因为你是JavaScript新手。 <select id = "pricingOptions" name = "pricingOptions"> <option value = "500">Option A</option> <option value = "1000">O

I want to load another HTML page after a specific amount of time

This question already has an answer here: How do I redirect to another webpage? 67 answers <script>setTimeout(function(){window.location.href='form2.html'},5000);</script> 而对于主页只添加'/' <script>setTimeout(function(){window.location.href="/"},3000);</script> <meta http-equiv="refresh" content="5;URL='form2.html'"> 使用此JavaScript代码: <script>

我想在特定时间后加载另一个HTML页面

这个问题在这里已经有了答案: 我如何重定向到另一个网页? 67个答案 <script>setTimeout(function(){window.location.href='form2.html'},5000);</script> 而对于主页只添加'/' <script>setTimeout(function(){window.location.href="/"},3000);</script> <meta http-equiv="refresh" content="5;URL='form2.html'"> 使用此JavaScript代码: <script> setTimeout(function(

jQuery location href

Possible Duplicate: How do I redirect to another webpage? I remember there's a redirect function in jQuery. It was like: $(location).href('http://address.com') But what was it exactly? I couldn't remember and can't find it using Google Search. 没有必要使用jQuery。 window.location.href = 'http://example.com'; Use: window.location.replace(...) See this Stack Overflow questi

jQuery位置href

可能重复: 我如何重定向到另一个网页? 我记得jQuery中有一个重定向函数。 它就像: $(location).href('http://address.com') 但究竟是什么呢? 我记不起并且无法使用Google搜索找到它。 没有必要使用jQuery。 window.location.href = 'http://example.com'; 使用: window.location.replace(...) 有关更多信息,请参阅此堆栈溢出问题: 我如何重定向到另一个网页? 或者也许是你记得的: var url = "http://s

How to go to a URL using jQuery?

This question already has an answer here: How do I redirect to another webpage? 67 answers How to get the browser to navigate to URL in JavaScript [duplicate] 3 answers How do we update URL or query strings using javascript/jQuery without reloading the page? 10 answers //As an HTTP redirect (back button will not work ) window.location.replace("http://www.google.com"); //like if you clic

如何去使用jQuery的URL?

这个问题在这里已经有了答案: 我如何重定向到另一个网页? 67个答案 如何让浏览器在JavaScript中导航到URL [复制] 3个答案 我们如何在不重新加载页面的情况下使用javascript / jQuery更新URL或查询字符串? 10个答案 //As an HTTP redirect (back button will not work ) window.location.replace("http://www.google.com"); //like if you click on a link (it will be saved in the session history, //so the back

$(document).ready equivalent without jQuery

I have a script that uses $(document).ready , but it doesn't use anything else from jQuery. I'd like to lighten it up by removing the jQuery dependency. How can I implement my own $(document).ready functionality without using jQuery? I know that using window.onload will not be the same, as window.onload fires after all images, frames, etc. have been loaded. There is a standards base

$(document).ready没有jQuery

我有一个使用$(document).ready的脚本,但它没有使用jQuery中的其他任何东西。 我想通过删除jQuery依赖项来减轻它的负担。 如何在不使用jQuery的情况下实现自己的$(document).ready功能? 我知道使用window.onload不会是一样的,因为window.onload会在加载所有图像,框架等后触发。 有一个基于标准的替代, DOMContentLoaded ,超过98%的浏览器支持,但不支持IE8: document.addEventListener("DOMContentLoaded", functi

Input placeholders for Internet Explorer

HTML5 introduced the placeholder attribute on input elements, which allows to display a greyed-out default text. Sadly the Internet Explorer, including IE 9 does not support it. There already are some placeholder simulator scripts out there. They typically work by putting the default-text into the input field, give it a grey color and remove it again as soon as you focus the input field. T

Internet Explorer的输入占位符

HTML5引入了input元素的placeholder属性,它允许显示灰色的默认文本。 可悲的是IE浏览器,包括IE 9不支持它。 已经有一些占位符模拟器脚本了。 他们通常通过将默认文本放入输入字段中,给它一个灰色,并在您关注输入字段后立即将其删除。 这种方法的缺点是占位符文本位于输入字段中。 从而: 脚本无法轻松检查输入字段是否为空 服务器端处理必须检查默认值,以便不将占位符插入到数据库中。 我想有一个解决方案,

Modify the URL without reloading the page

Is there any way I can modify the URL of the current page without reloading the page? I would like to access the portion before the # hash if possible. I only need to change the portion after the domain, so its not like I'm violating cross-domain policies. window.location.href = "www.mysite.com/page2.php"; // sadly this reloads This can now be done in Chrome, Safari, FF4+, and IE10pp4

修改网址而不重新加载页面

有什么方法可以修改当前页面的URL而无需重新加载页面? 如果可能,我想访问#哈希前的部分。 我只需要更改域后的部分,所以它不像我违反跨域策略。 window.location.href = "www.mysite.com/page2.php"; // sadly this reloads 现在可以在Chrome,Safari,FF4 +和IE10pp4 +中完成! 有关详情,请参阅此问题的答案:使用新网址更新地址栏,而不使用散列或重新加载页面 例: function processAjaxData(response, urlP

Get current URL in JavaScript?

I am using jQuery. How do I get the path of the current URL and assign it to a variable? Example URL: http://localhost/menuname.de?foo=bar&amp;number=0 要获得路径,您可以使用: var pathname = window.location.pathname; // Returns path only var url = window.location.href; // Returns full URL In pure jQuery style: $(location).attr('href'); The location object also has other prope

在JavaScript中获取当前网址?

我正在使用jQuery。 我如何获取当前URL的路径并将其分配给一个变量? 示例网址: http://localhost/menuname.de?foo=bar&amp;number=0 要获得路径,您可以使用: var pathname = window.location.pathname; // Returns path only var url = window.location.href; // Returns full URL 在纯jQuery风格: $(location).attr('href'); 位置对象还具有其他属性,如主机,散列,协议和路径名。 http://www.refulz

How to short circuit Array.forEach like calling break?

[1,2,3].forEach(function(el) { if(el === 1) break; }); 我怎样才能在JavaScript中使用新的forEach方法? There's no built-in ability to break in forEach . To interrupt execution you would have to throw an exception of some sort. eg. var BreakException = {}; try { [1, 2, 3].forEach(function(el) { console.log(el); if (el === 2) throw BreakException; }); } catch (e) { i

如何使Array.forEach短路像调用break?

[1,2,3].forEach(function(el) { if(el === 1) break; }); 我怎样才能在JavaScript中使用新的forEach方法? 有没有内置在能力break在forEach 。 要中断执行,你必须抛出某种异常。 例如。 var BreakException = {}; try { [1, 2, 3].forEach(function(el) { console.log(el); if (el === 2) throw BreakException; }); } catch (e) { if (e !== BreakException) throw e; } 你可以使用每种方法: