Home  >  Article  >  Web Front-end  >  Location.href statement is incompatible with Firefox_javascript tips

Location.href statement is incompatible with Firefox_javascript tips

WBOY
WBOYOriginal
2016-05-16 18:23:591229browse

A js is used to jump by clicking the button. The statement is very simple:



During testing, it was found that it can be used in IE but not in firefox. So I added a window in front of the location, that is, changed it to:

onclick="window.location.href('http://baidu.com');"

I found that it still didn’t work. .

So I went to Baidu and found an answer:

Use window.location="url"; instead of location.href('url');"

So I changed the source The program can be changed as follows:


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn