Menu
hello,
i have a little problem with a javascript
the function is named Calculate
in the form I call this function with:
onChange=”Calculate(this.id)”
in the function it all works fine except the focus.
in the alert line it seems to be that he knows that the value of ‘test’
is comming from the form ‘this.id’
but in the line below ‘test’ seems to be no longer a variable
and so I get the error that ‘document.CapExp.test is null or not an object’
how can I get the same value as in the alert line.
function Calculate(test)
{
alert(test);
document.CapExp.test.focus();
}
regards,
bart
<cfquery name="qAllocDiv" DATASOURCE="DBIntra"
username="#Decrypt(URLDecode(Session.DtbaseCon[t][2]), Session.key)#"
password="#Decrypt(URLDecode(Session.DtbaseCon[t][3]), Session.key)#">
SELECT *
FROM WW_DivPrdLin
WHERE DivPrdLinID > 99999
ORDER BY DivPrdLinDes
</cfquery>
<cfset whichPrdLin = #qAllocDiv.DivPrdLinID#>
</td>
</tr>
<cfquery name="qAllocPrdLin" DATASOURCE="DBIntra"
username="#Decrypt(URLDecode(Session.DtbaseCon[t][2]), Session.key)#"
password="#Decrypt(URLDecode(Session.DtbaseCon[t][3]), Session.key)#">
SELECT *
FROM WW_DivPrdLin
WHERE DivPrdLinID like left(#qAllocDiv.DivPrdLinID#, 1) + '%'
AND DivPrdLinID < 99999
ORDER BY DivPrdLinDes
</cfquery>
<cfoutput query="qAllocPrdLin">
<cfif #qAllocPrdLin.CurrentRow# Mod 2>
//-->
<!--- white line --->
<tr>
<td <!--- class="Label" ---> colspan="5"> </td>
</tr>
<tr>
<td <!--- class="Label" ---> colspan="5" class="LabelTitle">
<span style="text-align : left ; width : 250px ; ">Market</span>
<span style="text-align : right ; width : 370px ; ">
Total : <input type="text" name="TotalMkt" size="8" disabled value="0" class="InputDisabled">
</span>
</td>
</tr>
<cfquery name="qAllocMkt" DATASOURCE="DBIntra"
username="#Decrypt(URLDecode(Session.DtbaseCon[t][2]), Session.key)#"
password="#Decrypt(URLDecode(Session.DtbaseCon[t][3]), Session.key)#">
SELECT *
FROM Market
Where MktSts = 'MK'
AND MktID <> '*'
ORDER BY MktDes
</cfquery>
<cfoutput query="qAllocMkt">
<cfif #qAllocMkt.CurrentRow# Mod 2>
<tr>
<td class="Label">#MktDes# :</td>
<td class="Input">
<input type="text" name="#qAllocMkt.MktID#" size="8" value="0" onChange="CalculateMkt(); return true;" onKeypress="if ((event.keyCode > 0 && event.keyCode < 46) || (event.keyCode > 46 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 255)) event.returnValue = false;">
</td>
<td class="WhiteSpace"> </td>
<cfelse>
<td class="Label">#MktDes# :</td>
<td class="Input">
<input type="text" name="#qAllocMkt.MktID#" size="8" value="0" onChange="CalculateMkt(); return true;" onKeypress="if ((event.keyCode > 0 && event.keyCode < 46) || (event.keyCode > 46 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 255)) event.returnValue = false;">
</td>
</tr>
</cfif>
</cfoutput>
//-->
onChange="Calculate(this)"
function Calculate(test){
alert(test.id);
test.focus();
}
I think that would be easier if you would do it like that...0.1.9 — BETA 5.3