开发者

Call js function

开发者 https://www.devze.com 2023-02-10 10:37 出处:网络
<div id=\"picker-updatedDate{%= ID %}\" class=\"bordForTdPickerTables cellPadding cellNotEditable lastUpdateDIV\">{%= ConvertDateFromMSajax2JSFullDateStr(EnteredWhen) %}</div>
<div id="picker-updatedDate{%= ID %}" class="bordForTdPickerTables cellPadding cellNotEditable lastUpdateDIV">{%= ConvertDateFromMSajax2JSFullDateStr(EnteredWhen) %}</div>

But the function ConvertDateFromMSajax2JSFullDateStr开发者_如何学C doesn't get called.

How can I call the function?


Assuming ConvertDateFromMSajax2JSFullDateStr is client side JavaScript function and you want to pouplate the div with its output, passing server side argument, first have this code in your page:

<script type="text/javascript">
window.onload = function() {
   var oDiv = document.getElementById("picker-updatedDate<%=ID%>");
   oDiv.innerHTML = ConvertDateFromMSajax2JSFullDateStr("<%=EnteredWhen%>");
}
</script>

Then correct syntax for the div itself is:

<div id="picker-updatedDate<%=ID%>" class="bordForTdPickerTables cellPadding cellNotEditable lastUpdateDIV"></div>

Make sure to have the code assigning values to ID and EnteredWhen variables before the above.


Your question is unclear and your code is syntactically incorrect. As others have pointed out, there is no javascript function provided in your example.

ASP delimiters are "<% %>" not "{% %}"

To "call" a function in ASP you can use :

<% call MyFunctionName() %>

However, by using the explicit call statement, no value is returned from the function.

if the function is to return a value then omit the call statement:

<%= MyFunctionName() %>

0

精彩评论

暂无评论...
验证码 换一张
取 消