我正在尝试从HTML中的按钮调用事件到Javascript函数(“mySubmit()”)。 当我点击按钮时,似乎我没有进入JS功能,因为警报没有出现。任何想法如何使其有效?
@model List<Campaign>
<!DOCTYPE html>
<html>
<style type="text/css">
h1
{
padding: 0px;
margin: 0px;
line-height: 10px;
}
</style>
<head>
<meta name="viewport" content="width=device-width" />
<script type="text/javascript">
function mySubmit() {
alert('submit1');
}
</script>
<title>Customer details</title>
</head>
<body>
<div dir="rtl">
<h1>
details</h1>
<br />
<h4>
Phone: @ViewBag.CLID</h4>
<p>
<h4 style="display:inline">
Phone2:</h4>
<input id="ReturnCLID" type="text" value="@ViewBag.CLID" />
</p>
<p style="display:inline">
Campaign:
</p>
<select id="dropdowncamp">
@for (int i = 0; i < Model.Count; i++)
{
if (Model[i].CampaignID.ToString() == ViewBag.CampaignCode)
{
<option value=@Model[i].CampaignID selected>
@Model[i].CampaignDescription
</option>
}
else
{
<option value=@Model[i].CampaignID>
@Model[i].CampaignDescription
</option>
}
}
</select>
<h4>
Date: @ViewBag.DialAtInterval</h4>
</div>
<input id="Button1" style="align: center; margin-left: auto; margin-right: auto;
display: block" type="button" value="GO" onclick="mySubmit()" />
</body>
</html>