שלח תשובה

זירת השאלות

504
צפיות
4
תשובות

Javascript script

,‏ 2 באוגוסט, 2005



Till now i worked with js with a quite stupid way… wrote code for each browser independly or just ignored old browsers.
is there any version of js that i can use and which will work on ALL browsers? i mean all new generation browsers (IE & Netscape 4+)…


tnx 🙂

תגיות:

4 תשובות

  1. shay3434 הגיב:

    היום רוב הדפדפנים תומכים בJS כך שאם
    תכתוב את הקוד כמו שצריך, רוב הדפדפנים הנפוצים יתמכו.
    לא נראה לי שיש דרך לגרום לג'אווה סקריפט לעבוד על כל הדפדפנים.
    הדפדפנים הישנים, שלא תומכים בJS ינסו לפענח את הקוד כHTML ויכול להווצר מצב של שגיאה ושיבוש כל המשך העמוד. מה שאפשר לעשות נגד זה, זה פשוט לסמן את הסקריפט בסימני הערה של HTML וכך דפדפנים ישנים יתעלמו מהקוד ושאר העמוד לא יפגע (מלבד זה שאותו סקריפט ספציפי לא יפעל). חוץ מזה, לא נראה לי שאפשר לעשות משהו כדי להציג את JS בכל הדפדפנים פשוט כי זו בעיה בדפדפנים ולא בשפה…

  2. eLisHa הגיב:

    thats what im asking…


    for reference of javascript, especially calling a HTML tag from Js, a thing which till now i made with 3 if conditions.. and its quite stupid

    there IS a way of writing it this way (1 call to a tag which will work on IE & FF the quite new versions), but im not sure about it

    i've try'ed
    document[***].*** & document.all[***].***
    will work only on IE

    document.getelementbyid[***]
    not sure about the syntax, but i think this is it
    whats the full cmd to use this?

  3. BuildHome הגיב:

    תשתמש בשני
    document.getElementById('someID')
    אל תשכח ש-JS זו שפה רגישה לאותיות גדולות וקטנות.

שלח תשובה