Rumah > hujung hadapan web > tutorial js > Gunakan JavaScript untuk menulis kemahiran calculator_javascript yang mudah

Gunakan JavaScript untuk menulis kemahiran calculator_javascript yang mudah

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Lepaskan: 2016-05-16 16:30:20
asal
1538 orang telah melayarinya

Kaedah dalam artikel ini sangat mudah dan ideanya sangat disyorkan Kawan, sila rujuk

Salin kod Kod adalah seperti berikut:


kalkulator ringkas javascript
//Tentukan pembolehubah global var one="1"; var two="2";
var three="3";
var four="4";
var five="5";
var six="6";
      var seven="7"; var lapan="8"; var sembilan="9";       var zero="0";          var tambah=" ",tolak="-",darab="*",bahagi="/",perpuluhan=".";            fungsi enter(obj,rentetan){
                                                                                                                                                                                                                                                                                                      kepada                }
function compute(obj){//Fungsi yang dipanggil dengan mengklik sama dengan butang "=";       obj.expr.value=eval(obj.expr.value);//Gunakan JS untuk mendapatkan kaedah eval() untuk mengira nama sebagai formula dalam expr }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           & Lt; td & gt; & lt;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
         
         
         
         
         
         
         
         
 


是不是超级NB的代码,大神级的!

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan