Получаю ошибку Un-Caught 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>