Firebug jumps 'missing ) after element list' when there is ')'
this is my function to update src value
function browse(id,url){
alert(url);
document.getElementById("main").value = url ;
}
this is how i call it:
<li style="min-width:350px;" title="click to play me"><a href="#" onclick="browse(68118,http://push2check.com/)" >开发者_JS百科' . $this->titulo . '</a><li>
this is firebug error (of corse the alert is never executed): missing ) after argument list [Interrumpir en este error] browse(68118,http://push2check.com/);
What i dunt understand is the error, is the onclick ok?
It's because of this:
<a href="#" onclick="browse(68118,http://push2check.com/)" >' . $this->titulo . '</a>
That URL needs to be quoted:
<a href="#" onclick="browse(68118,'http://push2check.com/')" >' . $this->titulo . '</a>
The value you give an "onclick" attribute has to be a valid HTML attribute value that contains valid JavaScript. If you wrote:
<script>
var x = http://push2check.com/;
you would probably not expect that to work; the URL syntax doesn't mean anything directly to JavaScript, so it would be a syntax error.
精彩评论