Page 1 of 1

hLink

Posted: Fri Jul 24, 2009 12:17 am
by Stela
Hello…

I can't make this work:

Code: Select all

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP/MySQL Programming Course Part 2</title>
<script language="JavaScript">
    function go2Page(hLink){
        window.location = "index.php?function=edit&mode="+hLink+"";
    }
</script>
</head>
…
<body>
    <td align="center"><input name="edit1" type="button" value="Edit" onclick="javascript(go2Page(<? echo $myrowRes['statVal_id']; ?>));"/></td>
</body>
I press the Edit Button, but the address bar remains the same. What I'm doing wrong?

Thanks!

Re: hLink

Posted: Fri Jul 24, 2009 2:59 am
by VladSun
It's [js]... onclick="function_name(params)" ...[/js]
not [js]... onclick="javascript(function_name(params))" ...[/js]

EDIT: Some stupid comments removed :)

Re: hLink

Posted: Fri Jul 24, 2009 3:22 am
by Stela
That's it!!! :D :D :D

I just started to learn JavaScript and I get this line of code from a tutorial (what a tutorial :? ).

Many thanks :wink: