251 lines
8.0 KiB
HTML
251 lines
8.0 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<link rel="stylesheet" href="NumberPad/css/bootstrap.min.css">
|
||
<link rel="stylesheet" href="NumberPad/css/bootstrap-theme.min.css">
|
||
<link rel="stylesheet" type="text/css" href="NumberPad/css/htmleaf-demo.css">
|
||
<link rel="stylesheet" href="NumberPad/css/jquery.numpad.css">
|
||
<style type="text/css">
|
||
.nmpd-grid {border: none; padding: 20px;}
|
||
.nmpd-grid>tbody>tr>td {border: none;}
|
||
|
||
/* Some custom styling for Bootstrap */
|
||
.qtyInput {display: block;
|
||
width: 100%;
|
||
padding: 6px 12px;
|
||
color: #555;
|
||
background-color: white;
|
||
border: 1px solid #ccc;
|
||
border-radius: 4px;
|
||
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
|
||
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
|
||
-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
|
||
-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
|
||
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
|
||
}
|
||
</style>
|
||
|
||
|
||
<title>Document</title>
|
||
<style>
|
||
#invite{
|
||
margin: 10px;
|
||
}
|
||
p{
|
||
font-size: 25px;
|
||
}
|
||
li{
|
||
list-style-type: none;
|
||
margin: 10px 0px;
|
||
}
|
||
table{
|
||
margin: 5px;
|
||
}
|
||
input{
|
||
margin: 5px;
|
||
}
|
||
.btn{
|
||
font-size: 25px;
|
||
padding: 20px 30px;
|
||
}
|
||
.form-control{
|
||
width: 500px;
|
||
}
|
||
</style>
|
||
<script src="jquery-2.1.0.min.js"></script>
|
||
<script src="NumberPad/js/bootstrap.min.js"></script>
|
||
<script src="NumberPad/js/jquery.numpad.js"></script>
|
||
<script type="text/javascript">
|
||
|
||
// Set NumPad defaults for jQuery mobile.
|
||
// These defaults will be applied to all NumPads within this document!
|
||
|
||
$.fn.numpad.defaults.gridTpl = '<table class="table modal-content"></table>';
|
||
$.fn.numpad.defaults.backgroundTpl = '<div class="modal-backdrop in"></div>';
|
||
$.fn.numpad.defaults.displayTpl = '<input type="text" class="form-control" />';
|
||
$.fn.numpad.defaults.buttonNumberTpl = '<button type="button" class="btn btn-default" style="width: 80px; height: 80px"></button>';
|
||
$.fn.numpad.defaults.buttonFunctionTpl = '<button type="button" class="btn" style="width: 80px; height: 80px"></button>';
|
||
//$.fn.numpad.defaults.buttonNumberTpl = '<button type="button" class="btn btn-default"></button>';
|
||
//$.fn.numpad.defaults.buttonFunctionTpl = '<button type="button" class="btn" style="width: 100%;"></button>';
|
||
$.fn.numpad.defaults.onKeypadCreate = function(){$(this).find('.done').addClass('btn-primary');};
|
||
|
||
// Instantiate NumPad once the page is ready to be shown
|
||
$(document).ready(function(){
|
||
// $('#stations').numpad();
|
||
});
|
||
|
||
function add(){
|
||
var li1 = document.getElementById("li1");
|
||
//创建li
|
||
var lis = document.createElement("li");
|
||
//创建文本
|
||
var texts =document.createElement('input');
|
||
texts.setAttribute('type', 'text');//输入框的类型
|
||
texts.setAttribute('name', "station");//输入框的名字
|
||
texts.setAttribute('class', "input form-control");
|
||
var length=document.getElementsByTagName('li').length;
|
||
|
||
texts.setAttribute('id',"station"+length.toString());
|
||
//把文本添加到li下面 appendChild
|
||
|
||
lis.appendChild(texts);
|
||
//获取到div
|
||
var invite = document.getElementById("invite");
|
||
invite.insertBefore(lis,li1);
|
||
|
||
// $("#station"+length.toString()).numpad();
|
||
}
|
||
function minus(){
|
||
var lis=document.getElementsByTagName('li');
|
||
if(lis.length>=1) {
|
||
var li = lis[(lis.length - 1)];
|
||
li.parentNode.removeChild(li);
|
||
}
|
||
}
|
||
function sub(){
|
||
var inp = document.getElementsByName("station");
|
||
var inputs = new Array();
|
||
var sche_station="sche:"+Button_Sch_Enable;
|
||
for(var i=0; i<inp.length;i++){
|
||
// alert(inp[i].value); //获得输入框的值
|
||
inputs[i] = inp[i].value;
|
||
sche_station=sche_station+";"+inp[i].value;
|
||
}
|
||
sche_station=sche_station+"#";
|
||
console.log(sche_station);
|
||
client_request(sche_station);
|
||
//alert(inputs); //将输入框的值赋予inputs数组中
|
||
}
|
||
function schedisable(){
|
||
client_request("HMIScheDisable");
|
||
}
|
||
function scheenable(){
|
||
client_request("HMIScheEnable");
|
||
}
|
||
|
||
function HMIVehcileCtrlDebug(str){
|
||
client_request("HMIVehcileCtrlDebug:"+str);
|
||
}
|
||
function HMIImportLearn(str){
|
||
client_request("HMIImportLearn:"+str);
|
||
}
|
||
function HMIExportSQL(){
|
||
client_request("HMIExportSQL");
|
||
}
|
||
function HMIExportLearn(){
|
||
client_request("HMIExportLearn");
|
||
}
|
||
var Button_Sch_Enable=false;
|
||
function ButtonImage_Vertical_Click(){
|
||
if(Button_Sch_Enable==false){
|
||
Button_Sch_Enable=true;
|
||
document.getElementById("buttonimage_Vertical").setAttribute("src","Led_Display/Button_Vertical_On.bmp");
|
||
}
|
||
else{
|
||
Button_Sch_Enable=false;
|
||
document.getElementById("buttonimage_Vertical").setAttribute("src","Led_Display/Button_Vertical_Off.bmp");
|
||
}
|
||
}
|
||
|
||
function client_request(str){
|
||
$('#output').html("");
|
||
window.parent.postMessage(
|
||
{
|
||
event_id: 'client_request',
|
||
data: {
|
||
v1: str
|
||
}
|
||
},
|
||
"*" //or "www.parentpage.com"
|
||
);
|
||
}
|
||
|
||
function receiveMessage(event){
|
||
//console.log(event.data);
|
||
switch(event.data.event_id){
|
||
case "client_response":{
|
||
var data=event.data.data;
|
||
var result=data.v1;
|
||
var ROS_String_Output=data.v2;
|
||
var Rec_HMI_String_Input=data.v3;
|
||
var Client_Request_Cmd=Rec_HMI_String_Input.split(':');
|
||
//console.log(data);
|
||
switch(Client_Request_Cmd[0]){
|
||
case 'sche':{
|
||
document.getElementById('output').innerText=ROS_String_Output;
|
||
}break;
|
||
default:{
|
||
document.getElementById('output').innerText=ROS_String_Output;
|
||
}break;
|
||
}
|
||
}break;
|
||
}
|
||
}
|
||
|
||
window.addEventListener("message", receiveMessage, false);
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<table>
|
||
<tr>
|
||
<div id="output"></div>
|
||
</tr>
|
||
|
||
<tr>
|
||
<p>
|
||
<input type="button" class="input btn" value="schedisable" onclick="schedisable()">
|
||
</p>
|
||
</tr>
|
||
<tr>
|
||
<p>
|
||
<input type="button" class="input btn" value="scheenable" onclick="scheenable()">
|
||
</p>
|
||
</tr>
|
||
|
||
<tr>
|
||
<p style="margin-left: 10px">
|
||
Sche Enable:
|
||
<img id="buttonimage_Vertical" onclick="ButtonImage_Vertical_Click()" src="Led_Display/Button_Vertical_Off.bmp"/>
|
||
</p>
|
||
</tr>
|
||
<tr>
|
||
<form action="">
|
||
<p style="margin-left: 10px">Station:<span>(点击按钮+ - )</span></p>
|
||
<div id="invite">
|
||
<input type="text" class="input form-control" name="station" id="stations">
|
||
</div>
|
||
<input type="button" class="input btn" value="+" onclick="add()">
|
||
<input type="button" class="input btn" value="-" onclick="minus()">
|
||
<p>
|
||
<input type="button" class="input btn" value="完成" onclick="sub()">
|
||
</p>
|
||
</form>
|
||
</tr>
|
||
|
||
<tr>
|
||
<p><input type=text class="input form-control" id="HMIVehcileCtrlDebugStr" name=HMIVehcileCtrlDebugStr></input></p>
|
||
<input type="button" class="input btn" value="HMIVehcileCtrlDebug" onclick="HMIVehcileCtrlDebug(HMIVehcileCtrlDebugStr.value)">
|
||
</tr>
|
||
<tr>
|
||
<input type="button" class="input btn" value="HMIExportSQL" onclick="HMIExportSQL()">
|
||
</tr>
|
||
<tr>
|
||
<input type="button" class="input btn" value="HMIExportLearn" onclick="HMIExportLearn()">
|
||
</tr>
|
||
<tr>
|
||
<p><input type=text id="HMIImportLearnStr" name=HMIImportLearnStr></input></p>
|
||
<input type="button" value="HMIImportLearn" onclick="HMIImportLearn(HMIImportLearnStr.value)">
|
||
</tr>
|
||
</table>
|
||
</body>
|
||
<script>
|
||
$("#invite").on("focus",".input",function (){
|
||
window.top.inputDom = this;
|
||
var distance = $(parent.document).scrollTop() + 500 + "px";
|
||
$(".simple-keyboard", top.document).css("top", distance)
|
||
$(".keyboard",top.document).show();
|
||
window.top.clearKeyboard();
|
||
})
|
||
</script>
|
||
</html> |