504
צפיות
צפיות
4
תשובות
תשובות
Javascript script
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 תשובות
היום רוב הדפדפנים תומכים בJS כך שאם
תכתוב את הקוד כמו שצריך, רוב הדפדפנים הנפוצים יתמכו.
לא נראה לי שיש דרך לגרום לג'אווה סקריפט לעבוד על כל הדפדפנים.
הדפדפנים הישנים, שלא תומכים בJS ינסו לפענח את הקוד כHTML ויכול להווצר מצב של שגיאה ושיבוש כל המשך העמוד. מה שאפשר לעשות נגד זה, זה פשוט לסמן את הסקריפט בסימני הערה של HTML וכך דפדפנים ישנים יתעלמו מהקוד ושאר העמוד לא יפגע (מלבד זה שאותו סקריפט ספציפי לא יפעל). חוץ מזה, לא נראה לי שאפשר לעשות משהו כדי להציג את JS בכל הדפדפנים פשוט כי זו בעיה בדפדפנים ולא בשפה…
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?
תשתמש בשני
document.getElementById('someID')
אל תשכח ש-JS זו שפה רגישה לאותיות גדולות וקטנות.
thank you 🙂