Incorrect syntax, mainly in href = "#" here
Copy codeThe Code is as follows: Error code, mainly in href = "#"
The script is as follows:
Copy codeThe Code is as follows:
If (data = "sent successfully "){
Alert (data );
Window. location. href = window. location. href;
}
The correct href is followed by a javascript: void (0). If it is IE6, it is best to add a return false after onclick.
1:
Copy codeThe Code is as follows:
<A href = "javascript: void (0);" id = "send" onclick = "return buttonClick ();"> send </a>
2:
Copy codeThe Code is as follows:
<A href = "javascript: void (0);" id = "send" onclick = "buttonClick ()"> send </a>
3: This writing method is recommended, and ie6 can be perfectly supported.
Copy codeThe Code is as follows:
<A href = "javascript: void (0);" id = "send" onclick = "javascript: buttonClick (); return false;"> send </a>
The three methods above can be used, and there is no difference. When the return false is returned in the buttonClick function, the function is also blocked from continuing to run.