gpt4 book ai didi

php - 如何使用 mootools1.2 将网页中的损坏图像替换为一些错误图像

转载 作者:行者123 更新时间:2023-11-29 01:02:24 24 4
gpt4 key购买 nike

我在 php、mysql 上运行并使用 mootools1.2 作为我的 js 框架。

我希望所有损坏的图像都应替换为单个错误图像。

我应该怎么做。

谢谢

阿维纳什

最佳答案

此链接可能有帮助, http://davidwalsh.name/custom-missing-image

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 });

关于php - 如何使用 mootools1.2 将网页中的损坏图像替换为一些错误图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2198391/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com