正在收到错误未捕获的ReferenceError:未定义myFunction Javascript。 我添加了以下代码的HTML和Javascript:
JavaScript新手,请帮忙!
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<p>Some text in the Modal..</p>
<form>
EventID:<br>
<input type="text" name="EventID" id="EventID"><br>
Event Name:<br>
<input type="text" name="EventName" id="EventName"><br>
Speaker Name :<br>
<input type="text" name="SpeakerName" id="SpeakerName"><br>
</form>
<button onclick="myFunction()">Try it</button>
<script runat=server language="JavaScript" executioncontexttype="Post">
function myFunction() {
window.alert('Hi');
Platform.Load("Core","1.1");
var a = document.getElementById("EventID").value ;
var b = document.getElementById("EventName").value ;
var c = document.getElementById("SpeakerName").value;
var de = DataExtension.Init('EMS_Events');
var result = de.Rows.Add({EventID:'a',EventName:'b',SpeakerName:'c'});
de.Rows.Lookup
Write('<b>Output:</b>'+result);
}
</script>
</div>
</div>