javascript - Firebug jumps 'missing ) after element list' when there is ')' -


this function update src value

function browse(id,url){          alert(url);          document.getelementbyid("main").value = url ;        } 

this how call it:

<li style="min-width:350px;" title="click play me"><a href="#"  onclick="browse(68118,http://push2check.com/)" >' . $this->titulo . '</a><li> 

this firebug error (of corse alert never executed): missing ) after argument list [interrumpir en este error] browse(68118,http://push2check.com/);

what dunt understand error, onclick ok?

it's because of this:

<a href="#"  onclick="browse(68118,http://push2check.com/)" >' . $this->titulo . '</a> 

that url needs quoted:

<a href="#"  onclick="browse(68118,'http://push2check.com/')" >' . $this->titulo . '</a> 

the value give "onclick" attribute has valid html attribute value contains valid javascript. if wrote:

<script>    var x = http://push2check.com/; 

you not expect work; url syntax doesn't mean directly javascript, syntax error.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -