Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 有了这段代码,我在屏幕左下角看到IE页面加载错误_Javascript_Asp.net_Jquery_Asp.net Mvc - Fatal编程技术网

Javascript 有了这段代码,我在屏幕左下角看到IE页面加载错误

Javascript 有了这段代码,我在屏幕左下角看到IE页面加载错误,javascript,asp.net,jquery,asp.net-mvc,Javascript,Asp.net,Jquery,Asp.net Mvc,我有这个代码在我看来 <div> <input type="button" value="Cancel" id="btnCancel" onclick="window.location.href='../Reviewer'" />&nbsp;<input type="submit" value="Save" id="btnSave" onclick="saveCreateHeader()"/><input type="button" style=

我有这个代码在我看来

<div>
<input type="button" value="Cancel" id="btnCancel" onclick="window.location.href='../Reviewer'" />&nbsp;<input type="submit" value="Save" id="btnSave" onclick="saveCreateHeader()"/><input type="button" style="margin-left:50px;" id="btnNextStep" value="Next Step"   onclick="window.location.href='../CostSharingQuestionsIndex/<%=Model.ProductTemplateID %>')"/> 
</div>

我不明白为什么在最后一次单击中有一个结束括号。这可能会导致您的错误。



我不明白为什么在最后一次单击中有一个结束括号。这可能会导致您的错误。

首先,我会采取完全不同的方法,根据需要使用锚并设置它们的样式,但使用它们的本机行为,例如:

<a href="../CostSharingQuestionsIndex/<%=Model.ProductTemplateID %>">Next Step</a>
字符串中有一个额外的
,它应该是这样的:

onclick="window.location.href='../CostSharingQuestionsIndex/<%=Model.ProductTemplateID %>')"
onclick="window.location.href='../CostSharingQuestionsIndex/<%=Model.ProductTemplateID %>'"
onclick=“window.location.href=”../CostSharingQuestionsIndex/”

有了它,它正试图解析……嗯,我不确定它到底会怎么想,但它并不漂亮,因此您会看到错误。

首先,我会采取完全不同的方法,根据需要使用锚并设置它们的样式,但使用它们本机的
行为,例如:

<a href="../CostSharingQuestionsIndex/<%=Model.ProductTemplateID %>">Next Step</a>
字符串中有一个额外的
,它应该是这样的:

onclick="window.location.href='../CostSharingQuestionsIndex/<%=Model.ProductTemplateID %>')"
onclick="window.location.href='../CostSharingQuestionsIndex/<%=Model.ProductTemplateID %>'"
onclick=“window.location.href=”../CostSharingQuestionsIndex/”

有了它,它就试图解析……嗯,我不确定它到底会怎么想,但它并不漂亮,因此您看到了错误。

我将首先清理标记并使用适当的元素来尊重HTML语义

<div>
    <!-- You want a redirect here so use anchor, eventually style it with CSS -->
    <%= Html.ActionLink("Cancel", "Reviewer", null, new { id = "btnCancel", @class = "btnCancel" }) %>

    <input type="submit" value="Save" id="btnSave" />

    <!-- You want a redirect here so use anchor, eventually style it with CSS -->
    <!-- Notice the usage of routes here to avoid hardcoding urls -->
    <%= Html.ActionLink("Next Step", "CostSharingQuestionsIndex", new { id = Model.ProductTemplateID }, new { id = "btnNextStep", @class = "btnNextStep" }) %>
</div>
或者,由于这是一个提交按钮,您可以直接使用该按钮所属表单的提交事件。如果它不属于表单,则不应使用“提交”按钮


所有这些都意味着,如果您使用ASP.NET MVC和jquery,您可以更好地利用它。

我将首先清理标记并使用适当的元素来尊重HTML语义

<div>
    <!-- You want a redirect here so use anchor, eventually style it with CSS -->
    <%= Html.ActionLink("Cancel", "Reviewer", null, new { id = "btnCancel", @class = "btnCancel" }) %>

    <input type="submit" value="Save" id="btnSave" />

    <!-- You want a redirect here so use anchor, eventually style it with CSS -->
    <!-- Notice the usage of routes here to avoid hardcoding urls -->
    <%= Html.ActionLink("Next Step", "CostSharingQuestionsIndex", new { id = Model.ProductTemplateID }, new { id = "btnNextStep", @class = "btnNextStep" }) %>
</div>
或者,由于这是一个提交按钮,您可以直接使用该按钮所属表单的提交事件。如果它不属于表单,则不应使用“提交”按钮


所有这些都意味着,如果您使用ASP.NET MVC和jquery,您可以更好地利用它。

不应该只有一个单引号和一个双引号吗?没有两个单引号?@Brandon-Oops,最初在双粘贴中错过了,谢谢!难道不应该只有一个单引号和一个双引号吗?没有两个单引号?@Brandon-Oops,最初在双粘贴中错过了,谢谢!