كيفية استبدال الصور المكسورة في صفحة الويب ببعض صور الخطأ بـ Mootools1.2

StackOverflow https://stackoverflow.com/questions/2198391

سؤال

أنا أركض على PHP و MySQL وأستخدم Mootools1.2 كإطار JS الخاص بي.

أريد أن تستبدل جميع الصور المكسورة صورة خطأ واحدة.

كيف أفعل ذلك.

شكرًا

أفيناش

هل كانت مفيدة؟

المحلول

قد يساعد هذا الرابط ،http://davidwalsh.name/custom-missing-emage

1 window.addEvent('domready',function() {
2  /* version 1 */
3  $$('img.missing1').addEvent('error',function() {
4    this.set({
5      src: 'http://davidwalsh.name/dw-content/missing-image.jpg',
6      alt: 'Sorry!  This image is not available!',
7      styles: {
8        width: 110,
9        height:40
10      }
11    });
12  });
13  /* version 2 */
14  $$('img.missing2').addEvent('error',function() {
15    this.set({
16      src: 'http://davidwalsh.name/dw-content/missing-image-2.jpg',
17      alt: 'Sorry!  This image is not available!',
18      styles: {
19        width: 30,
20        height:28
21      }
22    });
23  });
24 });
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top