<a href="#" onclick="return Actionclick('<%= Url.Action("Activate", new {id = item.company_id}) %>', '<%= Html.Encode(item.company1.company_name.Replace("'", "'")) %>');" class="fg-button fg-button-icon-solo ui-state-default ui-corner-all"><span class="ui-icon ui-icon-refresh"></span></a>
<script type="text/javascript">
function Actionclick(url, companyName)
{
if (confirm('This action will activate this company\'s primary company ('+companyName+') and all of its other subsidiaries. Continue?'))
{
location.href = url;
};
};
编辑 确认信息显示的是&# 39;而不是'。当我在这里输入时,它将&# 39;替换为'。添加空格以防止发生这种情况。我想知道将其传递给我的onclick事件的最佳方法,并且在消息中正确显示它,而不进行多次替换(如果有更好的方法)。