הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   "there is no attribute "onload (https://hosts.co.il/forums/showthread.php?t=55595)

rsl 25-10-07 02:29

"there is no attribute "onload
 
אני משתמש ב- onload כדי לזמן פונקציה מסויימת מקובץ javascript

כשאני בודק את הדף ב w3c validator אני מקבל רק error אחד.

קוד:

there is no attribute "onload".
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

בניתי את הדף כ: XHTML 1.0 Transitional
לא מצאתי דרך לפתור את זה, אני צריך את עזרתכם :/
יש אולי איזה דרך לשלב את זה בדרך אחרת ולא עם onload?

meshuga 25-10-07 02:53

ציטוט:

נכתב במקור על ידי rsl (פרסם 571111)
אני משתמש ב- onload כדי לזמן פונקציה מסויימת מקובץ javascript

כשאני בודק את הדף ב w3c validator אני מקבל רק error אחד.

קוד:

there is no attribute "onload".
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

בניתי את הדף כ: XHTML 1.0 Transitional
לא מצאתי דרך לפתור את זה, אני צריך את עזרתכם :/
יש אולי איזה דרך לשלב את זה בדרך אחרת ולא עם onload?

על איזה תג שמת את זה?
אם זה על body, אז אין לי מושג..
אם זה לא...אז נראה לי שמותר לשים את זה רק על body

rsl 25-10-07 13:24

ציטוט:

נכתב במקור על ידי meshuga (פרסם 571114)
על איזה תג שמת את זה?
אם זה על body, אז אין לי מושג..
אם זה לא...אז נראה לי שמותר לשים את זה רק על body

שמתי את זה על img ... כנראה שזה לא מותר
אבל איך אני יכול לפתור את זה שזה עדיין יעשה את הפעולה שאני רוצה ושזה יעבור את הבדיקה?
אפשר אולי איכשהו לשלב כזה דבר ב-css או משהו כזה?

בניה 25-10-07 13:39

למה ה onload מחכה?
שהתמונה תטען?

somebody 25-10-07 15:53

אם זו פונקציה שהשימוש בה הוא רק בonload יש דרך לעשות את זה ב JS.
אתה כותב:

PHP קוד:

onload=function()
{
הפונקציה


וזה כמובן נימצא בין תגי JS.

rsl 26-10-07 18:53

ציטוט:

נכתב במקור על ידי בניה (פרסם 571215)
למה ה onload מחכה?
שהתמונה תטען?

כן, זה סקריפט שבמידה והתמונה חורגת מהגדלים שאני קובע זה מקטין אותה ורק אם לוחצים עליה קליק בעכבר היא נפתחת לגודל הרגיל שלה, ואם לוחצים שוב זה מקטין אותה שוב.

ציטוט:

נכתב במקור על ידי somebody (פרסם 571257)
אם זו פונקציה שהשימוש בה הוא רק בonload יש דרך לעשות את זה ב JS.
אתה כותב:

PHP קוד:

onload=function()
{
&
#1492;פונקציה


וזה כמובן נימצא בין תגי JS.

נו ובמידה וזה בין תגי javascript.. איך זה יכול להשפיע על תמונה ספציפית? ממש לא הבנתי את הרעיון :/

O-B 26-10-07 19:45

עם ID..

rsl 26-10-07 20:25

ניסיתי ולא הלך לי.

ניסיתי לעשות את זה ככה:
קוד:

<script language='JavaScript' type='text/javascript' src='script.js'>
<!--
onload=function sizecap() {
imageSizeCap(this, 800, 800);
}
//-->
</script>

זה ב-HEAD

וב-img עשיתי משהו כמו זה:
קוד:

<img src="pic.jpg" id="sizecap" />
וזה לא עבד לי ... פשוט לא טען את התמונה.

חיים 26-10-07 20:53

HTML קוד:

<script language='JavaScript' type='text/javascript' src='script.js'>
<!--
document.getElementById('sizecap').onload=function(){
imageSizeCap(this, 800, 800);
}
//-->

</script>


rsl 26-10-07 21:06

תודה רבה על הניסיון, אבל לצערי גם זה לא פועל.


כל הזמנים הם GMT +2. הזמן כעת הוא 01:21.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ