استكمالا للدرس السابق: دمج xhtml مع javascript
حضرت هنا مثالين (اضغط على زر أضف):
مثال بدون CDATA
مثال باضافة CDATA (يرجى استعمال Firefox مع الاضافة HTML Validator)
عند استعمال وسوم HTML مع أوامر JS
<script type="text/javascript"> document.write('i love cssguy <br />'); document.write('i love azhar design') </script>
ستظهر العبارة i love cssguy وتحتها i love azhar design .. واذا كنت تستعمل الإضافة HTML Validator سيظهر لك الخطأ التالي:
document type does not allow element "br" hereولتجاوز هذا الخطأ نضيف ما يلي:
<script type="text/javascript"> //< ![CDATA[ document.write('i love cssguy <br />'); document.write('i love azhar design') //]]> </script>
الان لدينا صفحة خالية من الاخطاء ومتوافقة مع اختبارات w3c













درس سهل ومفيد
اعطاني هدا الخطأ
“<” + “/” + letter not allowed here
Cause:
The 2 characters “</” have been detected in a wrong place.
Example:
In most cases, this is due to wrong javascript:
Good document.write(“”);
Good document.write(“”);
Solution:
Add a “\” in the javascript code.
ما هي الاضافة التي تستعملها اذا كانت HTML Validator، اذهب الى options الخاص بهذه الاضافة وتأكد ان الخيار في Algorithm هو SGML أو Serial