<script>
function write_href() {
</script>
<?php
//If cars >10
if (cars>10) {
?>
<script> window.open("bilar.php",'_self'); </script>
<?php } else {?>
<script>alert("var god invänta svar!");</script>
<?php } //end else?>
<script> } //end function </script>
<a oNclick="javascript:write_href();"><b>inkommande svar</b></a>
Why it shows an alert box when the page is loaded is strange. It seems like it enters the function without a function call. Have tested with onclick, action and href. They all do the same. Any idea what's wrong here?
thanx!
Last edited by md7dani on Thu Sep 30, 2010 2:30 pm, edited 1 time in total.
script tags are not like PHP tags that you can open and close and put partial code anywhere you want. Do a view source on your page.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.