HTA VBScript и CSS3 + HTML5. Код не работает правильно, когда применяется <meta> для css3
У меня проблема с применением CSS3 и довольно круглых кнопок в моем приложении HTA.
Как только я включу<meta http-equiv="x-ua-compatible" content="ie=9">
тег, чтобы включить CSS3 в коде идет прямо в ад.
Подсчет работает неправильно, и похоже, что он работает с копией значений из массивов.arrX
, Я проверил это сmsgbox
и после нажатия он считается правильным, но затем возвращается к0
.
Когда я удаляюmeta
тег и скобка в последних двух подпрограммахsub SaveData()
а такжеsub ExitWindow()
и удалите скобки из всехonclick
Сценарий работает как шарм.
Блин CSS3 ломает это.
Можете ли вы помочь мне и сказать, почему он не работает и работает с копией аргументов из массивов?
Благодарю. :)
<!--DOCTYPE html-->
<html>
<head>
<meta http-equiv="x-ua-compatible" content="ie=9">
<style type="text/css">
body {
background-color:white;}
table, th, td {
border: 1px black;
color: black;
font-family:"Lucida Console";
font-size:100%;}
table {
width:500px;}
th {
text-align:left;}
td {
text-align:center;}
#maintd {
color:blue;
text-align:left;}
<!--#arrowtd {
width:100px;}-->
#runbutton {
border: 2px solid #a1a1a1;
background: #dddddd;
border-radius: 25px;}
</style>
<title>KPI reporting tool</title>
<HTA:APPLICATION
APPLICATIONNAME="KPI reporting tool"
CAPTION="yes"
SYSMENU="no"
SCROLL="no"
BORDER="thin"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<Script language="VBscript">
'==============================================================================================================
'KPI weights - EDIT HERE | KPI weights - EDIT HERE | KPI weights - EDIT HERE | KPI weights - EDIT HERE
'==============================================================================================================
Sinc = 12
Rtask = 7
Reassignment = 2
Update = 2
Transfer = 5
Assisted = 3
PassingBack = 3
'==============================================================================================================
'SCRIPT - DO NOT EDIT !!!
'==============================================================================================================
'==============================================================================================================
'ON LOAD SCRIPT TO SHOW KPI WEIGHTS
'==============================================================================================================
Sub Window_OnLoad
window.resizeTo 550,280
UserValue1.InnerHTML = Sinc
UserValue2.InnerHTML = Rtask
UserValue3.InnerHTML = Reassignment
UserValue4.InnerHTML = Update
UserValue5.InnerHTML = Transfer
UserValue6.InnerHTML = Assisted
UserValue7.InnerHTML = Passingback
End Sub
'==============================================================================================================
'REPORTING ARRAY
'==============================================================================================================
Dim arr0,arr1,arr2,arr3,arr4,arr5,arr6,arr7,arr8
arr0 = Array("Action", "Weight", "No. of times", "Points")
arr1 = Array("Incidents", Sinc, 0, 0)
arr2 = Array("Requests", Rtask, 0, 0)
arr3 = Array("Reassignments",Reassignment, 0, 0)
arr4 = Array("Updates", Update, 0, 0)
arr5 = Array("Transfers", Transfer, 0, 0)
arr6 = Array("Assists", Assisted, 0, 0)
arr7 = Array("Passing back",Passingback, 0, 0)
arr8 = Array()
'msgbox(arr1(1)) 'TEST MSGBOX
'==============================================================================================================
'SUB FOR COUNTING DOWN WITH FAIL-SAFE FOR NUMBERS BELOW ZERO
'==============================================================================================================
Sub RunScriptDown(DataAreaXa,DataAreaXb,arrX)
If arrX(2)>0 And arrx(3)>0 Then 'No. of times >0 AND Sum cannot be <0
arrx(2) = arrX(2) - 1
arrx(3) = arrX(3) - arrX(1) 'Sum = Sum - Weight
Else MsgBox "Value cannot be less than 0!",48,"ERROR"
End If
DataAreaXa.InnerHTML = arrX(2) 'No. of times
DataAreaXb.InnerHTML = arrX(1)*arrX(2) 'Weight*No. of times
DataAreaSum.InnerHTML = arr1(3)+arr2(3)+arr3(3)+arr4(3)+arr5(3)+arr6(3)+arr7(3)
msgbox(arrX(0) &" | " & "No.of times: " & arrX(2) & " | " & "total: " & arrX(3)) 'TEST MSGBOX
End Sub
'==============================================================================================================
'SUB FOR COUNTING UP
'==============================================================================================================
Sub RunScriptUp(DataAreaXa,DataAreaXb,arrX)
arrX(2) = arrX(2) + 1
arrx(3) = arrX(3) + arrX(1)
DataAreaXa.InnerHTML = arrX(2)
DataAreaXb.InnerHTML = arrX(1)*arrX(2)
DataAreaSum.InnerHTML = arr1(3)+arr2(3)+arr3(3)+arr4(3)+arr5(3)+arr6(3)+arr7(3)
msgbox(arrX(0) &" | " & "No.of times: " & arrX(2) & " | " & "total: " & arrX(3)) 'TEST MSGBOX
End Sub
'==============================================================================================================
'SUB FOR SAVING STATS TO A FILE
'==============================================================================================================
Sub SaveData()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
relativePath = wshShell.CurrentDirectory
path = relativePath & "\KPI_STATS\"
statDate = Now
statFile = Month(statDate) & "-" & Day(statDate) & "-" & Year(statDate) & ".tsv"
Set objNetwork = CreateObject("WScript.Network")
statUser = objNetwork.UserDomain & "\" & objNetwork.UserName
If objFSO.FolderExists(path) Then
'DO NOTHING
Else Set objFolder = objFSO.CreateFolder(path)
End If
msgbox(path & statFile)
If objFSO.FileExists (path & statFile) Then
MsgBox "File already exists!",48,"ERROR"
Else objFSO.CreateTextFile (path & statFile)
End If
Set objFile = objFSO.OpenTextFile (path & statFile, 8)
strLine = statUser & vbTab & statDate & vbCrLf & _
"--------------------------------------------------------" & vbCrLf & _
arr0(0) & vbTab & vbTab & arr0(1) & vbTab & arr0(2) & vbTab & arr0(3) & vbCrLf & _
arr1(0) & vbTab & arr1(1) & vbTab & arr1(2) & vbTab & vbTab & arr1(3) & vbCrLf & _
arr2(0) & vbTab & arr2(1) & vbTab & arr2(2) & vbTab & vbTab & arr2(3) & vbCrLf & _
arr3(0) & vbTab & arr3(1) & vbTab & arr3(2) & vbTab & vbTab & arr3(3) & vbCrLf & _
arr4(0) & vbTab & vbTab & arr4(1) & vbTab & arr4(2) & vbTab & vbTab & arr4(3) & vbCrLf & _
arr5(0) & vbTab & arr5(1) & vbTab & arr5(2) & vbTab & vbTab & arr5(3) & vbCrLf & _
arr6(0) & vbTab & vbTab & arr6(1) & vbTab & arr6(2) & vbTab & vbTab & arr6(3) & vbCrLf & _
arr7(0) & vbTab & arr7(1) & vbTab & arr7(2) & vbTab & vbTab & arr7(3) & vbCrLf & _
"--------------------------------------------------------" & vbCrLf & _
vbTab & vbTab & vbTab & vbTab & vbTab & arr1(3)+arr2(3)+arr3(3)+arr4(3)+arr5(3)+arr6(3)+arr7(3) & " TOTAL points"
objFile.WriteLine strLine
objFile.Close
End Sub
'==============================================================================================================
'EXIT SUB
'==============================================================================================================
Sub ExitWindow()
usrExit = MsgBox("Do you really want to exit?" & vbCrLf & "All unsaved data will be lost!",52,"WARNING!")
If usrExit = vbYes Then
self.close()
Else
End If
End Sub
</Script>
<!--HTML PART OF THE SCRIPT. WAY THE WINDOW LOOKS-->
<body>
<table>
<tr>
<th>Event</th>
<th></th>
<th>Weight</th>
<th>Times done</th>
<th>TOTAL</th>
</tr>
<tr>
<td id="maintd">INCIDENTS:</td>
<td id="arrowtd"><input id=runbutton type="button" value="←" onClick="RunScriptDown(DataArea1a,DataArea1b,arr1)">
<input id=runbutton type="button" value="→" onClick="RunScriptUp(DataArea1a,DataArea1b,arr1)"></td>
<td><span id=UserValue1></span></td>
<td><span id=DataArea1a name=a></span></td>
<td><span id=DataArea1b name=a></span></td>
</tr>
<tr>
<td id="maintd">REQUESTS:</td>
<td id="arrowtd"><input id=runbutton type="button" value="←" onClick="RunScriptDown(DataArea2a,DataArea2b,arr2)">
<input id=runbutton type="button" value="→" onClick="RunScriptUp(DataArea2a,DataArea2b,arr2)"></td>
<td><span id=UserValue2></span></td>
<td><span id=DataArea2a name=b></span></td>
<td><span id=DataArea2b name=a></span></td>
</tr>
<tr>
<td id="maintd">REASSIGNMENTS:</td>
<td id="arrowtd"><input id=runbutton type="button" value="←" onClick="RunScriptDown(DataArea3a,DataArea3b,arr3)">
<input id=runbutton type="button" value="→" onClick="RunScriptUp(DataArea3a,DataArea3b,arr3)"></td>
<td><span id=UserValue3></span></td>
<td><span id=DataArea3a name=c></span></td>
<td><span id=DataArea3b name=a></span></td>
</tr>
<tr>
<td id="maintd">UPDATES:</td>
<td id="arrowtd"><input id=runbutton type="button" value="←" onClick="RunScriptDown(DataArea4a,DataArea4b,arr4)">
<input id=runbutton type="button" value="→" onClick="RunScriptUp(DataArea4a,DataArea4b,arr4)"></td>
<td><span id=UserValue4></span></td>
<td><span id=DataArea4a name=d></span></td>
<td><span id=DataArea4b name=a></span></td>
</tr>
<tr>
<td id="maintd">TRANSFERS:</td>
<td id="arrowtd"><input id=runbutton type="button" value="←" onClick="RunScriptDown(DataArea5a,DataArea5b,arr5)">
<input id=runbutton type="button" value="→" onClick="RunScriptUp(DataArea5a,DataArea5b,arr5)"></td>
<td><span id=UserValue5></span></td>
<td><span id=DataArea5a name=e></span></td>
<td><span id=DataArea5b name=a></span></td>
</tr>
<tr>
<td id="maintd">ASSISTS:</td>
<td id="arrowtd"><input id=runbutton type="button" value="←" onClick="RunScriptDown(DataArea6a,DataArea6b,arr6)">
<input id=runbutton type="button" value="→" onClick="RunScriptUp(DataArea6a,DataArea6b,arr6)"></td>
<td><span id=UserValue6></span></td>
<td><span id=DataArea6a name=f></span></td>
<td><span id=DataArea6b name=a></span></td>
</tr>
<tr>
<td id="maintd">PASSINGS:</td>
<td id="arrowtd"><input id=runbutton type="button" value="←" onClick="RunScriptDown(DataArea7a,DataArea7b,arr7)">
<input id=runbutton type="button" value="→" onClick="RunScriptUp(DataArea7a,DataArea7b,arr7)"></td>
<td><span id=UserValue7></span></td>
<td><span id=DataArea7a name=g></span></td>
<td><span id=DataArea7b name=a></span></td>
</tr>
<tr>
<td><input id=runbutton type="button" value="Exit" onClick="ExitWindow"></td>
<td><input id=runbutton type="button" value="Show Report" onClick="RunReport"></td>
<td><input id=runbutton type="button" value="Save Data" onClick="SaveData"></td>
<td><span id=DataAreaSum name=Sum></span></td>
</tr>
</table>
</body>
</html>