我收到一个错误 Un-Caught ReferenceError: myFunction is not defined 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>