Reputation: 29
I get this error: "missing ) after argument list" from firebug running this script. I attempted to us /' to nest the parameters in my window.open equation. Can anyone see what's wrong here?
onclick="getinfo(); setTimeout('window.open(/'checkout.php/', /'_self/', /'location=yes/', /'false/')',10000);"
Upvotes: 1
Views: 72
Reputation: 25750
As Dave said, move the code out of the onclick
and it will be much clearer:
onclick="myFunction()"
<script>
function myFunction() {
getinfo();
setTimeout(function() {
window.open('checkout.php', '_self', 'location=yes', 'false')
},
10000);
}
</script>
You could be more unobtrusive that this too, but this is a good start and it solves your quoting problem.
Upvotes: 1
Reputation: 160181
Quotes should be escaped with backslashes.
(Yet another reason to try and be a bit more unobtrusive with your JavaScript!)
Upvotes: 2
Reputation: 36957
The forward slashes need to be back slashes
onclick="getinfo(); setTimeout('window.open(\'checkout.php\', \'_self\', \'location=yes\', \'false\')',10000);"
Upvotes: 2