right off the bat - im a javascript noob so please forgive the question. im sure it is some stupid bit of syntax that i am missing, but im a middle tier developer trying to help out a friend!
so what im trying to do is post some form data from a javascript function that gets called from an anchor tag.. here are the relevant parts of the page code.
<html>
<head>
<script language="JavaS cript">
function setItemDetails( action,id,qty)
{
document.myform .pageAction.val ue = action;
document.myform .itemId.value = id;
document.myform .itemQty.value = qty;
document.myform .submit();
}
</head>
<body>
<form name="myform" action="http://myserver.com/cart.php" method="post">
<input type="hidden" name="pageActio n" value="0" />
<input type="hidden" name="itemId" value="0" />
<input type="hidden" name="itemQty" value="0" />
<a href="javascrip t:setItemDetail s('add_item',12 ,1)">Blah</a>
</form>
</body>
</html>
The idea was that the 'cart.php' page would get the POSTed data and use it, but i cant get the javascript function to fire. when i put "alert('test'); " in the href of the anchor tag it works, but for some reason it wont call the javascript function i have.
any help would be appreciated.
so what im trying to do is post some form data from a javascript function that gets called from an anchor tag.. here are the relevant parts of the page code.
<html>
<head>
<script language="JavaS cript">
function setItemDetails( action,id,qty)
{
document.myform .pageAction.val ue = action;
document.myform .itemId.value = id;
document.myform .itemQty.value = qty;
document.myform .submit();
}
</head>
<body>
<form name="myform" action="http://myserver.com/cart.php" method="post">
<input type="hidden" name="pageActio n" value="0" />
<input type="hidden" name="itemId" value="0" />
<input type="hidden" name="itemQty" value="0" />
<a href="javascrip t:setItemDetail s('add_item',12 ,1)">Blah</a>
</form>
</body>
</html>
The idea was that the 'cart.php' page would get the POSTed data and use it, but i cant get the javascript function to fire. when i put "alert('test'); " in the href of the anchor tag it works, but for some reason it wont call the javascript function i have.
any help would be appreciated.
Comment