admin管理员组文章数量:1336728
I get a "ReferenceError: punt is not defined" - everything seems to be right and I can't identify the mistake.
Here is the related code:
<script src="../Scripts/jquery-1.9.1.min.js" type="text/javascript">
function punt(rowIndex, Name, actionType) {
alert("hello");
}
</script>
and inside the ItemTemplate in the Repeater I have:
<input type="image" style="border-width:0" src='<%=ResolveUrl("~/css/images/icon_update.png") %>'
alt="Update Reviewer List" tabindex="0" title="Update Reviewer List"
onclick="punt(<%#Container.ItemIndex%>,
'<%#HttpUtility.HtmlEncode((string)DataBinder.Eval(Container.DataItem, "Name"))%>',
'Update');
return false;" />
I get a "ReferenceError: punt is not defined" - everything seems to be right and I can't identify the mistake.
Here is the related code:
<script src="../Scripts/jquery-1.9.1.min.js" type="text/javascript">
function punt(rowIndex, Name, actionType) {
alert("hello");
}
</script>
and inside the ItemTemplate in the Repeater I have:
<input type="image" style="border-width:0" src='<%=ResolveUrl("~/css/images/icon_update.png") %>'
alt="Update Reviewer List" tabindex="0" title="Update Reviewer List"
onclick="punt(<%#Container.ItemIndex%>,
'<%#HttpUtility.HtmlEncode((string)DataBinder.Eval(Container.DataItem, "Name"))%>',
'Update');
return false;" />
Share
edited Mar 27, 2013 at 19:34
Aleksandr M
24.4k13 gold badges74 silver badges146 bronze badges
asked Mar 27, 2013 at 19:33
user1216456user1216456
0
2 Answers
Reset to default 7You can't bine a script include and inline javascript.
<script src="../Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script>
function punt(rowIndex, Name, actionType) {
alert("hello");
}
</script>
Your script tag which includes the external script should be separate from your script tag where you define your new function, i.e.:
<!-- first script tag -->
<script src="jquery"></script>
<!-- second script tag -->
<script>
// punt function
</script>
本文标签: javascriptReferenceError function is not defined on the onclick functionStack Overflow
版权声明:本文标题:javascript - ReferenceError: function is not defined on the onclick function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742401935a2468058.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论