This example describes the JS hint: uncaught syntaxerror:unexpected token) Error resolution. Share to everyone for your reference, specific as follows:
Uncaught syntaxerror:unexpected token)
This exception is thrown by the following code:
<div class= "Hd_live_sharediv left" >
<a href= "javascript:void ()" onclick= "Loadliveplayer (' ud ')" style= " width:40px; " > Ultra-clear </a>
<a href= "javascript:void ()" onclick= "Loadliveplayer (' HD ')" style= "width:40px;" > HD </a>
<a href= "javascript:void ()" onclick= "Loadliveplayer (' SD ')" style= "width:40px;" > Fluency </a>
</div>
The cause of this error may be raised:
1, the href attribute value "javascript:void ()", does not add "0" in parentheses
void operator usage format is as follows:
①. javascript:void (expression)
②. Javascript:void expression
Expression is an expression of the Javascript standard to compute. The parentheses on the outer side of the expression are optional, but it is a good habit to write. (Implementation version Navigator 3.0)
You specify the hyperlink using the void operator. The expression is evaluated but no content is loaded at the current document.
<div class= "Hd_live_sharediv left" >
<a href= "javascript:void (0)" onclick= "Loadliveplayer (' ud ')" style= "width:40px;" > Ultra-clear </a>
<a href= "javascript:void (0)" onclick= "Loadliveplayer (' HD ')" style= "width:40px;" > HD </a>
<a href= "javascript:void (0)" onclick= "Loadliveplayer (' SD ')" style= "width:40px;" > Fluency </a>
</div>
2, the OnClick event handler function "Loadliveplayer" did not add the return value, causing javascript:void (0) to be executed, should add: returns false;
More readers interested in JavaScript-related content can view the site topics: "JavaScript value-Transfer Operation Tips Summary", "JavaScript Coding Operation Skills Summary", "JavaScript in the JSON Operation tips Summary", " JavaScript switching effects and techniques summary, "JavaScript Search Algorithm Skills Summary", "JavaScript animation effects and Skills summary", "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", JavaScript traversal algorithm and techniques summary and JavaScript mathematical Operational Usage Summary
I hope this article will help you with your JavaScript programming.