underlig fejl i formscript
Jeg sidder med en gammel netbutik som pludselig er begyndt at komme med fejl når man forsøger at tilføje vare til kurven.butikken benytter en javascriptdunktion til at submitte en hidden form.
koden ser sådanne ud
<script type="JavaScript">
function findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function skiftlayer(objName) { //v3.0
var obj = findObj(objName);
if (obj.style.visibility=="hidden") theValue1="visible";
if (obj.style.visibility=="visible") theValue1="hidden";
if(obj.style.display=="none") theValue2="block";
if (obj.style.display=="block") theValue2="none";
eval("obj.style.visibility='"+theValue1+"'");
eval("obj.style.display='"+theValue2+"'");
}
function addProduct(pid)
{
document.basket.productID.value = pid;
document.basket.submit();
}
</script>
<form action="/netshop/basketAddProduct.asp" method="post" name="basket">
<input type="hidden" name="productID" value="" />
<input type="hidden" name="refferer" value="/netshop/listproducts.asp?cid=148" />
</form>
<table border="0" cellpadding="0" cellspacing="0">
<tr class="tableHeader">
<td style="width:15px;" class="tableHeader"></td>
<td style="width:231px;" class="tableHeader">Vare:</td>
<td style="width:50px;" class="tableHeader">Rabat:</td>
<td style="width:75px;" class="tableHeader">Pris:</td>
<td style="width:80px;" class="tableHeader"></td>
</tr>
<tr class="tableRow1">
<td class="tableRow1" style="vertical-align:top;text-align:center;padding-top:2px;"> </td>
<td class="tableRow1" style="vertical-align:top;"> <span class="productListHeader"><a href="/netshop/showProduct.asp?cid=148&pid=23252">Osram HQI/TS pære 250 W / D - 12 stk. 5.500 kelvin</a></span> </td>
<td class="tableRow1" style="vertical-align:top;text-align:center;">10 %</td>
<td class="tableRow1" style="vertical-align:top;text-align:right;">6897,25</td>
<td class="tableRow1" style="vertical-align:top;text-align:center;"><a href="java script: addProduct(23252);">Læg i kurv</a></td>
</tr>
<tr class="tableRow2">
<td class="tableRow2" style="vertical-align:top;text-align:center;padding-top:2px;"> </td>
<td class="tableRow2" style="vertical-align:top;"> <span class="productListHeader"><a href="/netshop/showProduct.asp?cid=148&pid=23254">Osram HQI TS pære 250 W / D 5.500 kelvin</a></span> </td>
<td class="tableRow2" style="vertical-align:top;text-align:center;">10 %</td>
<td class="tableRow2" style="vertical-align:top;text-align:right;">661,00</td>
<td class="tableRow2" style="vertical-align:top;text-align:center;"><a href="java script:addProduct(23254);">Læg i kurv</a></td>
</tr>
</table>
nogen der forklarer mig hvad der lige går galt?
javascript-consolen i opera giver mig følgende at gå efter:
Javascript URL thread: "java script: addProduct(23253)"
Error:
name: ReferenceError
message: Statement on line 1: Reference to undefined variable: No such variable 'addProduct'
Backtrace:
In unknown script
addProduct(23253);