JavaScript and client side scripting.
Moderator: General Moderators
-
Stela
- Forum Commoner
- Posts: 46
- Joined: Tue Aug 12, 2008 12:38 pm
Post
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!
-
VladSun
- DevNet Master
- Posts: 4313
- Joined: Wed Jun 27, 2007 9:44 am
- Location: Sofia, Bulgaria
Post
by VladSun »
It's [js]... onclick="function_name(params)" ...[/js]
not [js]... onclick="javascript(function_name(params))" ...[/js]
EDIT: Some stupid comments removed

Last edited by
VladSun on Fri Jul 24, 2009 3:30 am, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
-
Stela
- Forum Commoner
- Posts: 46
- Joined: Tue Aug 12, 2008 12:38 pm
Post
by Stela »
That's it!!!
I just started to learn JavaScript and I get this line of code from a tutorial (what a tutorial

).
Many thanks
