Javascript running in Internet Explorer, not run on Mozilla Firefox

Recently I had a little experience makes me tired. Why not, more than 2 days I have not got javascript error in my web program

 In ASP.Net, I use a script, which calculates the number of characters from a text box. After the run, the program can work well, both on IE and Mozilla.

With the same script and the same goals, I also created a web page, but this time with PHP. I am testing the program with IE, and no problems. But after a try with Mozilla, the script does not go. Surprised and dizziness. What happened? With the same script, built with PHP can not work, but if made with ASP.NET can be, only in Mozilla, IE works well!

Browsing and serching on the internet, there is no solution.

I try to look more carefully at the script, well, thank you Jesus, I get the error on the identification text boxes.

In IE, atrribut name and id well known, and the same function, while in Mozilla Firefox, the name is the name and id is the id.

Consider this example:

java script command:
document.getElementById(‘txtSisa’)

while in the form:
<input type=”text” name=”txtSisa” size=”2″>

With the above conditions, the program can run well on IE, but fails when running on Mozilla. The program should be changed to (html part) :

<input type=”text” id=”txtSisa” size=”2″>

Hopefully helpful.

 

Javascript, jalan di IE, macet di Mozilla firefox

Baru-baru ini saya mengalami pengalaman yang sedikit membuat saya tertawa. Kenapa tidak, lebih dari 2 hari saya mencari kesalahan pada Javascript yang saya gunakan.

Dengan ASP.Net, saya menggunakan sebuah script, yang menghitung jumlah karakter dari sebuah text box. Setelah saya jalankan, maka program tersebut dapat berjalan dengan baik, baik pada IE maupun Mozilla.

Dengan script yang sama dan tujuan yang sama pula, saya juga membuat sebuah halaman web, tetapi kali ini dengan PHP. Saya mengetest program tersebut dengan IE, dan tidak ada masalah. Namun setelah dicoba dengan Mozilla, scriptnya tidak bisa jalan. Heran dan pusing. Kenapa bisa ya? Scriptnya sama, tetapi masa dengan ASP.NET bisa, dengan PHP tidak bisa, hanya di Mozilla pulak!

Browsing dan serching di internet, tidak ada solusi.

Saya coba pelototi lagi scriptnya, nah, ternyata kesalahannya pada identifikasi text box.

Pada IE, atrribut name dan id dikenal dengan baik, dan fungsinya sama, sementara di Mozilla Firefox, nama adalah nama dan id adalah id.

Coba perhatikan contoh ini :

pada java script kita jalankan perintah :

document.getElementById(‘txtSisa’)
sementara di form :
<input type=”text” name=”txtSisa” size=”2″>

Dengan kondisi diatas, program dapat berjalan dengan baik pada IE, tetapi gagal bila dijalankan pada Mozilla. Program harus diobah menjadi (bagian html-nya):

<input type=”text” id=”txtSisa” size=”2″>

Semga membantu.

130 Replies to “Javascript running in Internet Explorer, not run on Mozilla Firefox”

  1. mas koq ga bisa ya tetp aja aplikasi yang digunakan ajax,chrome js nya jalan tapi di fire fox tetap ga jalan.gimana donk mas ?thanx reply plz

Comments are closed.

RSS
Follow by Email
Facebook
Twitter
Visit Us
Follow Me
INSTAGRAM