Home > Web Front-end > JS Tutorial > body text

window.location.href = window.location.href jump no response a hyperlink onclick event writing method_javascript skills

WBOY
Release: 2016-05-16 17:25:00
Original
1427 people have browsed it

Wrong writing, mainly in href="#"

Copy code The code is as follows:
Wrong writing, mainly in href="#" here

The script is as follows

Copy code The code is as follows:

if (data == "Sent successfully") {
                                           alert(data);
The correct way to write href is followed by javascript:void(0). If it is IE6, it is best to add a return false after onclick

1:

Copy code

The code is as follows:Send
2:

Copy code

The code is as follows:Send
3: This writing method is recommended, ie6 can perfectly support it

Copy code

The code is as follows:Send
The above three ways of writing seem to work, and there is no difference. When the buttonClick function returns return false, it also prevents the function from continuing to run.
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!