我在cfwindow中加载了一些javascript。我在单击一个按钮时调用javascript函数。下面是加载在cfwindow中的代码。当我单击JS错误按钮时,显示如下:setVendorPayee是未定义的函数,onclick(SetVendorPayee){ setVendorPayee("126","sudheer");}(单击clientX=397,clientY=139),而我实际上在该函数中有.请帮帮忙
<script type="text/javascript">
function getRecords1(){
return true;
}
function setVendorPayee(vendorID,vendorName) {
if (ColdFusion.Window.getWindowObject('VendorPayeeSearch_CFWindow')){alert('hi');
document.ExpenseForm.payeeField#url.row#.value=vendorName;
document.ExpenseForm.payee_Person_ID#url.row#.value=vendorID;
ColdFusion.Window.hide('VendorPayeeSearch_CFWindow');
}
else if (window.opener && !window.opener.closed) {
window.opener.document.ExpenseForm.payeeField#url.row#.value=vendorName;
window.opener.document.ExpenseForm.payee_Person_ID#url.row#.value=vendorID;
window.close();
}
}
</script>
<cfform name="VendorForm" id="VendorForm" method="post" onsubmit="getRecords1();">
<table id="myTable" border="0" cellpadding="0" cellspacing="0" width="100%" class="noBorder">
<cfif Arguments.query.RecordCount>
<tr class="baseColorMedium">
<td align="center" > </td>
<td align="center" ><strong>Vendor Name</strong></td>
<td align="center" ><strong>Address 1</strong></td>
<td align="center" ><strong>Address 2</strong></td>
<td align="center"><strong>City</strong></td>
<td align="center" ><strong>State</strong></td>
<td align="center" ><strong>Zip Code</strong></td>
<td align="center" ><strong>Vendor Type</strong></td>
</tr>
<cfelse>
Your search did not return any results. Please modify your search criteria
</cfif>
<cfloop query="Arguments.query" >
<cfscript>
if (Arguments.query.CurrentRow mod 2 EQ 0) {
bgcolortoggle = "gridRowEven";
}
else {
bgcolortoggle = "gridRowOdd";
}
</cfscript>
<tr class="#bgcolortoggle#">
<td align="center"><cfinput type="button" name="btnSelect_#arguments.query.vendor_code#" value="Select" onClick ="setVendorPayee('#arguments.query.vendor_code#','#arguments.query.vendor_name#');" class="submitButton" /></td>
<td align="center">#HTMLEditFormat(trim(ucase(arguments.query.vendor_name)))#</td>
<td align="center">#HTMLEditFormat(trim(ucase(arguments.query.address_1)))#</td>
<td align="center">#HTMLEditFormat(arguments.query.Address_2)#</td>
<td align="center">#HTMLEditFormat(arguments.query.city)#</td>
<td align="center">#HTMLEditFormat(arguments.query.state)#</td>
<td align="center">#HTMLEditFormat(arguments.query.zip_code)#</td>
<td align="center">#HTMLEditFormat(arguments.query.vendor_type)#</a></td>
</tr>
</cfloop>
<tr>
<td width="100%" class="noBorder" colspan="8">
</td>
</tr>
<tr>
<td width="100%" class="noBorder" colspan="8">
<cfinput type="submit" id="btnSearch" name="btnAddNewVendor" value="Add Vendor" class="submitButton" />
</td>
</tr>
</table>
</cfform>发布于 2010-01-10 19:07:49
我为您做了一些研究,没有发现任何与使用onClick与cfinput有关的奇怪之处或怪癖。
想到要尝试的唯一一件事是将脚本块放到cfwindow内容之外。
我不确定这会不会有什么不同,但这是我首先要尝试的。
发布于 2010-01-11 18:45:21
可能需要添加<cfajaximport tags="cfform">,看看它是否有用。
https://stackoverflow.com/questions/2037979
复制相似问题