我用jquery写了一个js计算器,它可以在除IE之外的主要浏览器上运行,主要问题是输入元素根本不显示,输入也无法显示。输入被禁用以防止非法输入,我认为这可能是原因,但启用它们并不能解决问题。代码位于https://github.com/ZackYovel/jQCalc/tree/master/pathTo,演示位于http://jqcalc.co.nf/ 这里也是输入的 css:输入用这个 div:
#jQCalc-input-container:focus {
border: thin solid #fff;
background: rgb(237,247,253); /* Old browsers */
background: -moz-linear-gradient(top, rgba(237,247,253,1) 0%, rgba(255,255,255,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(237,247,253,1)), color-stop(100%,rgba(255,255,255,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(237,247,253,1) 0%,rgba(255,255,255,1) 100%); /* W3C */
-ms-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#edf7fd', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
这些是输入:
#jQCalc-expression-line, #jQCalc-result-line {
display: table-row;
background: none;
width: 95%;
margin: 0 auto;
border: none;
outline: none;
font-weight: bold;
}
#jQCalc-result-line {
letter-spacing: 1px;
font-size: 14pt;
}
#jQCalc-expression-line {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
letter-spacing: 2px;
}