2016-09-07 23 views
0

これはどのように可能か、まったくばかげています...時々動作しますが、ほとんどの場合は機能しません...キャッシュをクリアしました。 。Chromeブラウザを使用して... Chromeでデバッグしようとしましたが、まだ何も...私の最後にはコンソールエラーはありません...緑色の点は赤色でなければなりません...しかし、テキストは完全にうまく表示されます...テキストは更新されますがスタイル操作は更新されません

function init() 
 
{ 
 
\t updateIS2data(); 
 
    setInterval(updateIS2data, 1000); 
 
} 
 

 
function updateIS2data() 
 
{ 
 
\t var BP = 100;//getBatteryPercent(); 
 
\t var BS = 2//getBatteryState(); 
 
\t var LPM = "false";//isLowPower(); 
 
\t var txtLPM = ""; 
 
\t 
 
\t document.getElementById("battLevel").innerHTML = txtLPM + " " + BP + "%"; 
 
\t var BatteryImage = document.getElementById('BatteryImageLevel'); 
 
\t if(BP > 95){ w = 20; BatteryImage.style.backgroundColor = "RGB(50, 205, 50)"; } 
 
\t else if(BP <= 95 && BP > 90) { w = 19; BatteryImage.style.backgroundColor = "RGB(75, 205, 50)"; } 
 
\t else if(BP <= 90 && BP > 85) { w = 18; BatteryImage.style.backgroundColor = "RGB(100, 205, 50)"; } 
 
\t else if(BP <= 85 && BP > 80) { w = 17; BatteryImage.style.backgroundColor = "RGB(125, 205, 50)"; } 
 
\t else if(BP <= 80 && BP > 75) { w = 16; BatteryImage.style.backgroundColor = "RGB(150, 205, 50)"; } 
 
\t else if(BP <= 75 && BP > 70) { w = 15; BatteryImage.style.backgroundColor = "RGB(175, 205, 50)"; } 
 
\t else if(BP <= 70 && BP > 65) { w = 14; BatteryImage.style.backgroundColor = "RGB(200, 205, 50)"; } 
 
\t else if(BP <= 65 && BP > 60) { w = 13; BatteryImage.style.backgroundColor = "RGB(225, 205, 50)"; } 
 
\t else if(BP <= 60 && BP > 55) { w = 12; BatteryImage.style.backgroundColor = "RGB(250, 205, 50)"; } 
 
\t else if(BP <= 55 && BP > 50) { w = 11; BatteryImage.style.backgroundColor = "RGB(250, 195, 50)"; } 
 
\t else if(BP <= 50 && BP > 45) { w = 10; BatteryImage.style.backgroundColor = "RGB(250, 165, 50)"; } 
 
\t else if(BP <= 45 && BP > 40) { w = 9; BatteryImage.style.backgroundColor = "RGB(250, 155, 50)"; } 
 
\t else if(BP <= 40 && BP > 35) { w = 8; BatteryImage.style.backgroundColor = "RGB(250, 145, 50)"; } 
 
\t else if(BP <= 35 && BP > 30) { w = 7; BatteryImage.style.backgroundColor = "RGB(250, 135, 50)"; } 
 
\t else if(BP <= 30 && BP > 25) { w = 6; BatteryImage.style.backgroundColor = "RGB(250, 125, 50)"; } 
 
\t else if(BP <= 25 && BP > 20) { w = 5; BatteryImage.style.backgroundColor = "RGB(250, 115, 50)"; } 
 
\t else if(BP <= 20 && BP > 15) { w = 4; BatteryImage.style.backgroundColor = "RGB(250, 105, 50)"; } 
 
\t else if(BP <= 15 && BP > 10) { w = 3; BatteryImage.style.backgroundColor = "RGB(250, 95, 50)"; } 
 
\t else if(BP <= 10 && BP > 5) { w = 2; BatteryImage.style.backgroundColor = "RGB(250, 85, 50)"; } 
 
\t else if(BP <= 5 && BP > 0) { w = 1; BatteryImage.style.backgroundColor = "RGB(205, 50, 50)"; } 
 
\t BatteryImage.style.width = w; 
 
\t 
 
\t if(BS == 1) document.getElementById('isCharging').style.display = "none"; 
 
\t else if(BS == 2) document.getElementById('isCharging').style.display = "block"; 
 
\t 
 
\t var dLPM = document.getElementById("isLowPowerMode"); 
 
\t if(LPM == "false") 
 
\t { 
 
\t \t dLPM.innerHTML = "Testing"; 
 
\t \t dLPM.style.backgroundColor = "red;"; 
 
\t } else { 
 
\t \t dLPM.style.position = "asfdasfdasfd"; 
 
\t } 
 

 

 
\t //RAM Stats// 
 
\t //document.getElementById("freeRam").innerHTML = getRam() + "MB"; 
 
\t document.getElementById("freeRam").innerHTML = "1000MB"; 
 

 
\t //devicename// 
 
\t //document.getElementById("dName").innerHTML = deviceName(); 
 
\t document.getElementById("dName").innerHTML = "ShadowEvil's iPhone"; 
 
}
html 
 
{ 
 
\t position:absolute; 
 
\t margin:0px 0px; 
 
\t padding: 0; 
 
} 
 

 
@font-face 
 
{ 
 
\t font-family: def; 
 
\t src: url(../Fonts/Nokio-Light.ttf); 
 
} 
 
@font-face 
 
{ 
 
\t font-family: def1; 
 
\t src: url(../Fonts/Nokio-Regular.ttf); 
 
} 
 
@font-face 
 
{ 
 
\t font-family: def2; 
 
\t src: url(../Fonts/Nokio-Medium.ttf); 
 
} 
 

 
body 
 
{ 
 
\t background: url('../Images/bg.png') no-repeat; 
 
\t background-size: 320px; 
 
\t padding: 0; 
 
\t margin: 0; 
 
} 
 

 
#battLevel 
 
{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:27px; 
 
\t left: -30px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t z-index:15; 
 
\t text-align:right; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
} 
 

 
#BatteryImage 
 
{ 
 
\t position: absolute; 
 
\t width: 22px; 
 
\t height: 7px; 
 
\t top:29px; 
 
\t left: 292px; 
 
\t z-index:10; 
 
\t border: 1px solid white; 
 
\t Border-radius: 15px; 
 
} 
 

 
#isCharging 
 
{ 
 
\t margin-top: -6px; 
 
\t margin: -6px auto 0 auto; 
 
\t width: 20px; 
 
\t height: 7px; 
 
\t background: url('../Images/charging.png') no-repeat; 
 
} 
 

 
#isLowPowerMode 
 
{ 
 
\t position: absolute; 
 
\t left: 254px; 
 
\t top: 29px; 
 
\t width: 10px; 
 
\t height: 10px; 
 
\t z-index: 15; 
 
\t background-color: limegreen; 
 
\t Border-radius: 10px; 
 
} 
 

 
#BatteryImage #BatteryImageLevel 
 
{ 
 
\t margin-top: 1px; 
 
\t margin-left: 1px; 
 
\t width: 20px; 
 
\t height: 5px; 
 
\t z-index:15; 
 
\t background-color: limegreen; 
 
\t Border-radius: 15px; 
 
} 
 

 
#freeRam{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:27px; 
 
\t left:0px; 
 
\t margin-left: 10px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
\t z-index:15; 
 
} 
 

 
#dName 
 
{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:21px; 
 
\t left:0px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t z-index:15; 
 
\t text-align:center; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
} 
 

 
#DateWrap 
 
{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:30px; 
 
\t left:0px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t z-index:16; 
 
\t text-align:center; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
} 
 
#line{ 
 
    position: absolute; 
 
    top:0px; 
 
    left:0px; 
 
    height:42px; 
 
    width:320px; 
 
    Border-radius:0; 
 
    background-color: #383838; 
 
    border-bottom: 1px solid white; 
 
    z-index:8; 
 
    opacity:0.85; 
 
} 
 
#circle3{ 
 
    position: absolute; 
 
    top:21px; 
 
    left:250px; 
 
    height:45px; 
 
    width:45px; 
 
    Border-radius:100px; 
 
    background-color:383838; 
 
    border-bottom: 1px solid white; 
 
    border-left: 1px solid white; 
 
    border-right: 1px solid white; 
 
    z-index:8; 
 
    opacity:1.0; 
 
} 
 
#circle4{ 
 
    position: absolute; 
 
    top:26px; 
 
    left:256px; 
 
    height:35px; 
 
    width:35px; 
 
    Border-radius:100px; 
 
    background-color:fffffd; 
 
    border: 1px solid none; 
 
    z-index:8; 
 
    opacity:1.0; 
 
}
<html> 
 
<head> 
 
    <title>P.iW.14</title> 
 
<!--Scripts JunesiPhone, IS2 Matchstic, mod J3T,--> 
 
\t <meta name="viewport" content="width=320, height=568, initial-scale=1, maximum-scale=1, user-scalable=no"> 
 
\t <script src="Config.js"></script> 
 
\t <script src="js/Library/lang.js"></script> 
 
\t <link rel="stylesheet" type="text/css" href="css/main.css"> 
 
</head> 
 

 
<script src="js/IS2.js"></script> 
 
<script src="js/Library/clock.js"></script> 
 
<script type="text/cycript"> 
 
     var getBatteryPercent = function() { return [IS2System batteryPercent]; }; 
 
\t var getBatteryState = function() { return [IS2System batteryStateAsInteger]; }; 
 
\t var getRam = function() { return [IS2System ramFree]; }; 
 
\t var getSignal = function() { return [IS2Telephony phoneSignalBars]; }; 
 
\t var airplaneMode = function() { return [IS2Telephony airplaneModeEnabled]; } 
 
\t var WifiOn = function() { return [IS2Telephony dataConnectionAvailableViaWiFi]; }; 
 
\t var WifiSignal = function() { return [IS2Telephony wifiSignalBars]; }; 
 
\t var deviceName = function() { return [[UIDevice currentDevice] name]; }; 
 
\t var isLowPower = function() { return [[NSProcessInfo processInfo] isLowPowerModeEnabled]; }; 
 
</script> 
 

 
<body onload="init()"> 
 
<!--Library that handles clock info NO-EDIT--> 
 
     <div id="DateWrap"> 
 
\t \t <a id="month"></a> <a id="date"></a> <a id="year"></a> 
 
     </div> 
 
    <script src="js/clockMain.js"></script> 
 
<!--END Clock Widget--> 
 

 
<div id="line"></div> 
 
<div id="isLowPowerMode"></div> 
 
<div id="battLevel"></div> 
 
<div id="BatteryImage"><div id="BatteryImageLevel"></div><div id="isCharging"></div></div> 
 
<div id="freeRam"></div> 
 
<div id="dName"></div> 
 

 
<script> 
 

 
var width = window.innerWidth; 
 

 
if(width == 375) 
 
{ 
 
\t viewport = document.querySelector("meta[name=viewport]"); 
 
\t viewport.setAttribute('content', 'width=device-width, initial-scale=1.18, maximum-scale=1.18, user-scalable=0'); 
 
} else if(width == 414) { 
 
\t viewport = document.querySelector("meta[name=viewport]"); 
 
\t viewport.setAttribute('content', 'width=device-width, initial-scale=1.3, maximum-scale=1.3, user-scalable=0'); 
 
} 
 

 
</script> 
 

 
\t 
 
</body> 
 
</html>

+0

https://stackoverflow.com/help/mcve – Robert

答えて

0

セミコロンインラインスタイルを追加する際に必要ではありません。エラーが発生します。 dLPM.style.backgroundColor = "red";

function init() 
 
{ 
 
\t updateIS2data(); 
 
    setInterval(updateIS2data, 1000); 
 
} 
 

 
function updateIS2data() 
 
{ 
 
\t var BP = 10;//getBatteryPercent(); 
 
\t var BS = 2//getBatteryState(); 
 
\t var LPM = "false";//isLowPower(); 
 
\t var txtLPM = ""; 
 
\t 
 
\t document.getElementById("battLevel").innerHTML = txtLPM + " " + BP + "%"; 
 
\t var BatteryImage = document.getElementById('BatteryImageLevel'); 
 
\t if(BP > 95){ w = 20; BatteryImage.style.backgroundColor = "RGB(50, 205, 50)"; } 
 
\t else if(BP <= 95 && BP > 90) { w = 19; BatteryImage.style.backgroundColor = "RGB(75, 205, 50)"; } 
 
\t else if(BP <= 90 && BP > 85) { w = 18; BatteryImage.style.backgroundColor = "RGB(100, 205, 50)"; } 
 
\t else if(BP <= 85 && BP > 80) { w = 17; BatteryImage.style.backgroundColor = "RGB(125, 205, 50)"; } 
 
\t else if(BP <= 80 && BP > 75) { w = 16; BatteryImage.style.backgroundColor = "RGB(150, 205, 50)"; } 
 
\t else if(BP <= 75 && BP > 70) { w = 15; BatteryImage.style.backgroundColor = "RGB(175, 205, 50)"; } 
 
\t else if(BP <= 70 && BP > 65) { w = 14; BatteryImage.style.backgroundColor = "RGB(200, 205, 50)"; } 
 
\t else if(BP <= 65 && BP > 60) { w = 13; BatteryImage.style.backgroundColor = "RGB(225, 205, 50)"; } 
 
\t else if(BP <= 60 && BP > 55) { w = 12; BatteryImage.style.backgroundColor = "RGB(250, 205, 50)"; } 
 
\t else if(BP <= 55 && BP > 50) { w = 11; BatteryImage.style.backgroundColor = "RGB(250, 195, 50)"; } 
 
\t else if(BP <= 50 && BP > 45) { w = 10; BatteryImage.style.backgroundColor = "RGB(250, 165, 50)"; } 
 
\t else if(BP <= 45 && BP > 40) { w = 9; BatteryImage.style.backgroundColor = "RGB(250, 155, 50)"; } 
 
\t else if(BP <= 40 && BP > 35) { w = 8; BatteryImage.style.backgroundColor = "RGB(250, 145, 50)"; } 
 
\t else if(BP <= 35 && BP > 30) { w = 7; BatteryImage.style.backgroundColor = "RGB(250, 135, 50)"; } 
 
\t else if(BP <= 30 && BP > 25) { w = 6; BatteryImage.style.backgroundColor = "RGB(250, 125, 50)"; } 
 
\t else if(BP <= 25 && BP > 20) { w = 5; BatteryImage.style.backgroundColor = "RGB(250, 115, 50)"; } 
 
\t else if(BP <= 20 && BP > 15) { w = 4; BatteryImage.style.backgroundColor = "RGB(250, 105, 50)"; } 
 
\t else if(BP <= 15 && BP > 10) { w = 3; BatteryImage.style.backgroundColor = "RGB(250, 95, 50)"; } 
 
\t else if(BP <= 10 && BP > 5) { w = 2; BatteryImage.style.backgroundColor = "RGB(250, 85, 50)"; } 
 
\t else if(BP <= 5 && BP > 0) { w = 1; BatteryImage.style.backgroundColor = "RGB(205, 50, 50)"; } 
 
\t BatteryImage.style.width = w; 
 
\t 
 
\t if(BS == 1) document.getElementById('isCharging').style.display = "none"; 
 
\t else if(BS == 2) document.getElementById('isCharging').style.display = "block"; 
 
\t 
 
\t var dLPM = document.getElementById("isLowPowerMode"); 
 
\t if(LPM == "false") 
 
\t { 
 
\t \t dLPM.innerHTML = "Testing"; 
 
\t \t dLPM.style.backgroundColor = "red"; 
 
\t } else { 
 
\t \t dLPM.style.position = "asfdasfdasfd"; 
 
\t } 
 

 

 
\t //RAM Stats// 
 
\t //document.getElementById("freeRam").innerHTML = getRam() + "MB"; 
 
\t document.getElementById("freeRam").innerHTML = "1000MB"; 
 

 
\t //devicename// 
 
\t //document.getElementById("dName").innerHTML = deviceName(); 
 
\t document.getElementById("dName").innerHTML = "ShadowEvil's iPhone"; 
 
}
html 
 
{ 
 
\t position:absolute; 
 
\t margin:0px 0px; 
 
\t padding: 0; 
 
} 
 

 
@font-face 
 
{ 
 
\t font-family: def; 
 
\t src: url(../Fonts/Nokio-Light.ttf); 
 
} 
 
@font-face 
 
{ 
 
\t font-family: def1; 
 
\t src: url(../Fonts/Nokio-Regular.ttf); 
 
} 
 
@font-face 
 
{ 
 
\t font-family: def2; 
 
\t src: url(../Fonts/Nokio-Medium.ttf); 
 
} 
 

 
body 
 
{ 
 
\t background: url('../Images/bg.png') no-repeat; 
 
\t background-size: 320px; 
 
\t padding: 0; 
 
\t margin: 0; 
 
} 
 

 
#battLevel 
 
{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:27px; 
 
\t left: -30px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t z-index:15; 
 
\t text-align:right; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
} 
 

 
#BatteryImage 
 
{ 
 
\t position: absolute; 
 
\t width: 22px; 
 
\t height: 7px; 
 
\t top:29px; 
 
\t left: 292px; 
 
\t z-index:10; 
 
\t border: 1px solid white; 
 
\t Border-radius: 15px; 
 
} 
 

 
#isCharging 
 
{ 
 
\t margin-top: -6px; 
 
\t margin: -6px auto 0 auto; 
 
\t width: 20px; 
 
\t height: 7px; 
 
\t background: url('../Images/charging.png') no-repeat; 
 
} 
 

 
#isLowPowerMode 
 
{ 
 
\t position: absolute; 
 
\t left: 254px; 
 
\t top: 29px; 
 
\t width: 10px; 
 
\t height: 10px; 
 
\t z-index: 15; 
 
\t background-color: limegreen; 
 
\t Border-radius: 10px; 
 
} 
 

 
#BatteryImage #BatteryImageLevel 
 
{ 
 
\t margin-top: 1px; 
 
\t margin-left: 1px; 
 
\t width: 20px; 
 
\t height: 5px; 
 
\t z-index:15; 
 
\t background-color: limegreen; 
 
\t Border-radius: 15px; 
 
} 
 

 
#freeRam{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:27px; 
 
\t left:0px; 
 
\t margin-left: 10px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
\t z-index:15; 
 
} 
 

 
#dName 
 
{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:21px; 
 
\t left:0px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t z-index:15; 
 
\t text-align:center; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
} 
 

 
#DateWrap 
 
{ 
 
\t position: absolute; 
 
\t width:320px; 
 
\t top:30px; 
 
\t left:0px; 
 
\t color:fffffd; 
 
\t font-size:10px; 
 
\t font-family: def1; 
 
\t z-index:16; 
 
\t text-align:center; 
 
\t text-shadow: 1px 1px 2px rgba(0,0,0,0.8); 
 
} 
 
#line{ 
 
    position: absolute; 
 
    top:0px; 
 
    left:0px; 
 
    height:42px; 
 
    width:320px; 
 
    Border-radius:0; 
 
    background-color: #383838; 
 
    border-bottom: 1px solid white; 
 
    z-index:8; 
 
    opacity:0.85; 
 
} 
 
#circle3{ 
 
    position: absolute; 
 
    top:21px; 
 
    left:250px; 
 
    height:45px; 
 
    width:45px; 
 
    Border-radius:100px; 
 
    background-color:383838; 
 
    border-bottom: 1px solid white; 
 
    border-left: 1px solid white; 
 
    border-right: 1px solid white; 
 
    z-index:8; 
 
    opacity:1.0; 
 
} 
 
#circle4{ 
 
    position: absolute; 
 
    top:26px; 
 
    left:256px; 
 
    height:35px; 
 
    width:35px; 
 
    Border-radius:100px; 
 
    background-color:fffffd; 
 
    border: 1px solid none; 
 
    z-index:8; 
 
    opacity:1.0; 
 
}
<html> 
 
<head> 
 
    <title>P.iW.14</title> 
 
<!--Scripts JunesiPhone, IS2 Matchstic, mod J3T,--> 
 
\t <meta name="viewport" content="width=320, height=568, initial-scale=1, maximum-scale=1, user-scalable=no"> 
 
\t <script src="Config.js"></script> 
 
\t <script src="js/Library/lang.js"></script> 
 
\t <link rel="stylesheet" type="text/css" href="css/main.css"> 
 
</head> 
 

 
<script src="js/IS2.js"></script> 
 
<script src="js/Library/clock.js"></script> 
 
<script type="text/cycript"> 
 
     var getBatteryPercent = function() { return [IS2System batteryPercent]; }; 
 
\t var getBatteryState = function() { return [IS2System batteryStateAsInteger]; }; 
 
\t var getRam = function() { return [IS2System ramFree]; }; 
 
\t var getSignal = function() { return [IS2Telephony phoneSignalBars]; }; 
 
\t var airplaneMode = function() { return [IS2Telephony airplaneModeEnabled]; } 
 
\t var WifiOn = function() { return [IS2Telephony dataConnectionAvailableViaWiFi]; }; 
 
\t var WifiSignal = function() { return [IS2Telephony wifiSignalBars]; }; 
 
\t var deviceName = function() { return [[UIDevice currentDevice] name]; }; 
 
\t var isLowPower = function() { return [[NSProcessInfo processInfo] isLowPowerModeEnabled]; }; 
 
</script> 
 

 
<body onload="init()"> 
 
<!--Library that handles clock info NO-EDIT--> 
 
     <div id="DateWrap"> 
 
\t \t <a id="month"></a> <a id="date"></a> <a id="year"></a> 
 
     </div> 
 
    <script src="js/clockMain.js"></script> 
 
<!--END Clock Widget--> 
 

 
<div id="line"></div> 
 
<div id="isLowPowerMode"></div> 
 
<div id="battLevel"></div> 
 
<div id="BatteryImage"><div id="BatteryImageLevel"></div><div id="isCharging"></div></div> 
 
<div id="freeRam"></div> 
 
<div id="dName"></div> 
 

 
<script> 
 

 
var width = window.innerWidth; 
 

 
if(width == 375) 
 
{ 
 
\t viewport = document.querySelector("meta[name=viewport]"); 
 
\t viewport.setAttribute('content', 'width=device-width, initial-scale=1.18, maximum-scale=1.18, user-scalable=0'); 
 
} else if(width == 414) { 
 
\t viewport = document.querySelector("meta[name=viewport]"); 
 
\t viewport.setAttribute('content', 'width=device-width, initial-scale=1.3, maximum-scale=1.3, user-scalable=0'); 
 
} 
 

 
</script> 
 

 
\t 
 
</body> 
 
</html>

+0

私は...、今作品の魅力のように付け加えまま、なぜ私にはわからない...ありがとう...笑 –

関連する問題