Files
apt-nl-map/static/Magic4/Sketch/HMI_Sketch_Left_LearnSQLImport_Sch1.html
2024-12-04 10:21:04 +08:00

58 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript">
function SketchLeftSch1PostMessage(str){
parent.window.postMessage(
str,
"*" //or "www.parentpage.com"
);
}
function receiveMessage(event){
//console.log("aaaa");
//console.log(event.data);
switch(event.data.event_id){
case "client_response_left_learnsqlimport_main":{
var data=event.data.data;
var result=data.v1;
var ROS_String_Output=data.v2;
var Rec_HMI_String_Input=data.v3;
console.log(ROS_String_Output);
snsArr=ROS_String_Output.split(/[(\r\n)\r\n]+/);
snsArr.forEach((item,index)=>{
if(!item){
snsArr.splice(index,1);//删除空项
}
else{
var MyDiv =document.getElementById("output");
var button = document.createElement("input");
button.setAttribute("type", "button");
button.setAttribute("class", "btn");
button.setAttribute("value", snsArr[index]);
button.style.width = "80%";
button.style.height = "50px";
button.style.background="Cyan";
button.setAttribute("onclick", "SketchLeftSch1PostMessage('Sch1_LearnSQLImport:'+this.value)");
MyDiv.appendChild(button);
}
});
}break;
}
}
window.addEventListener("message", receiveMessage, false);
</script>
<title>Title</title>
</head>
<body>
HMI_Sketch_Left_LearnSQLImport_Sch1
<tr>
<div id="output"></div>
</tr>
</body>
</html>