битые ссылки на картинки
есть код который по идее должен отлавливать битые ссылки на картинки и заменять на empty.gif
<script type="text/javascript"> // обработчик битых ссылок $('img').error(function(){ $(this).attr('src', 'empty.gif'); }); </script> но он почему-то не заменяет. весь уже запутался, не знаю что происходит. лог: Код:
Unsafe JavaScript attempt to access frame with URL chrome-extension://hgimnogjllphhhkhlmebbmlgjoejdpjl/bar.html from frame with URL http://mysite/. Domains, protocols and ports must match. |
// обработчик битых ссылок $(function(){ $('img').error(function(){ $(this).attr('src', 'empty.gif'); }); }); ? |
Uncaught ReferenceError: $ is not defined
|
Цитата:
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <!-- <link rel="stylesheet" type="text/css" href="tmp.css" /> --> <style type="text/css"> </style> <script type="text/javascript"> </script> </head> <body> <img src='tmp.png' /> <img src='tmp.png' /> <img src='tmp.png' /> <img src='tmp.png' /> <img src='tmp.png' /> <img src='tmp.png' /> <script type="text/javascript"> $('img').error(function(){ this.src='http://javascript.ru/forum/images/smilies/sad.gif'; }); </script> </body> </html> |
Цитата:
<html> <head> <link href="favicon.ico" rel="icon" type="image/x-icon" /> <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <div class="mainMainDiv"> <div class="mainDiv"> <table class="mainTable"> <tr> <td class="headCol" colspan=3> <a href=index.php><!--<img height=100 border=0 src="logo.png" />--> _______ _ / ______) | | ______ __ __ __ __ _ __<br /> | | | | / _____) \ \ / / \ \ / / | | / /<br /> | | | |_____ | | \ \ / / \ \ / / | | / /<br /> | | | _____ \ | |____ \ \ / / \ \/ / | |/ /<br /> | | | | | | | ____) \ \_/ / \ / | _ \<br /> | |______ | | | | | |_____ \ / | | | | \ \<br /> \_______) |_| |_| \______) -- |_| |_| \_\<br /></a></td> </tr> <tr> <td class="leftCol"> <div class="menu"><html> <head> <link type="text/css" rel="stylesheet" href="style.css" /> </head> <body> <div id="menuDiv"> <div class=menuDiv>categories:</div></div><br /> <a id="menuLink" href=index.php?page=category&category=notebooks&pagen=1><div id="menuItem">notebooks</div></a><br /><a id="menuLink" href=index.php?page=category&category=ppc&pagen=1><div id="menuItem">ppc</div></a><br /><a id="menuLink" href=index.php?page=category&category=%F1%EE%EF%F3%F2%F1%F2%E2%F3%FE%F9%E8%E5+%F2%EE%E2%E0%F0%FB&pagen=1><div id="menuItem">сопутствующие товары</div></a><br /> </body> </html></div> <div class="authorization"> <html> <head><link rel=stylesheet type="text/css" href=style.css></head> <body> <div class=menuDiv> authorization</div><br /> <form method="post" action="proof.php"> <input type=text size=10 name="login" id="login">login <br /> <input type=password size=10 name="password" id="password">password <br /> <input type=submit value="Вход"><br /> <a href="index.php?page=registration">registration</a> <br /> <a href="index.php?page=remember">remember</a> </form> </body> </html> </div> <div class="friends"><html> <body> друзяки:<br /> <a href="http://google.com">google</a><br /></body> </html></div> </td> <td class="middleCol"> <div class="product"><table ><tr><td colspan=6><img src=http://rozetka.com.ua/data/products/sml/img09259.jpg /></td></tr><tr ><td><a href=index.php?page=product&id=11>Asus U2E (U2E-U760SCABAW)</a></td><td>1699</td><td>11.1" WXGA ColorShine LED/ Core 2 Duo U7600 (1.2GHz) / 2Gb / 120 GB / DVD Super Multi / FM / LAN / WiFi / BT / FP / Camera / bag / Vista Business / 1.25kg</td><td></td></tr></table></div><div class="product"><table ><tr><td colspan=6><img src=http://rozetka.com.ua/data/products/sml/img07902.jpg /></td></tr><tr ><td><a href=index.php?page=product&id=10>Asus V1Sn (V1Sn-T930XCEGAW) Акция!!!</a></td><td>1754</td><td>15,4" WSXGA+ Glare / Core 2 Duo T9300 (2,5Ghz) / 2Gb + 1Gb TM/ 250GB + ext.160Gb / GeForce 9500M 512MB/ DVD Super Multi / LAN / FM / WiFi / BT / FP / Camera / Vista Premium / Bag / Dock / 2.7kg</td><td></td></tr></table></div><div class="product"><table ><tr><td colspan=6><img src=http://rozetka.com.ua/data/products/sml/img10980.jpg /></td></tr><tr ><td><a href=index.php?page=product&id=9>Asus Lamborghini VX3 (VX3y-T930XFGUAW)(VX3y-T930SFGUAW) Акция!!!</a></td><td>2799</td><td>12.1" WXGA/ Core 2 Duo T9300 (2.5GHZ) / 4GB / 320GB / Ge Force 9300M/ DVD Super Multi / LAN / WiFi / BT / FP / Web cam / Vista Ultimate / bag /1.68kg / Yellow</td><td></td></tr></table></div><div class="product"><table ><tr><td colspan=6><img src=http://rozetka.com.ua/data/products/sml/img11128.jpg /></td></tr><tr ><td><a href=index.php?page=product&id=8>Lenovo IdeaPad Y710-2A (59015368) Акция!!!</a></td><td>2068</td><td>17.0" WUXGA Glare/ Core 2 Duo T9300 (2.5GHz) / 4Gb / 500GB / Blu-Ray / ATI X2600 512Mb / FM / Lan / WiFi / BT / Camera / VistaHP / 3.58 kg</td><td></td></tr></table></div><div class="product"><table ><tr><td colspan=6><img src=http://rozetka.com.ua/data/products/sml/img18383.jpg /></td></tr><tr ><td><a href=index.php?page=product&id=7>Toshiba Qosmio X300-13R (PQX32E-038012RU) Акция!!!</a></td><td>2209</td><td>17"WXGA+ / Core 2 Duo P8600 (2.4Ghz) / 4GB / 320GB / GeForce 9700M / DVD RW / LAN / WiFi / BT/ FP / RC / Camera / Vista Home Premium / 4.3 кг</td><td></td></tr></table></div> </td> <td class="rightCol"> <html> <body> $$$$$$$$$$$$ $$$$$$$$$$$$ </body> </html></td> </tr> <tr> <td class="footCol" colspan=3> интернет-магазин "": всякая ""<br />developed by chevyk </tr> </table> </div> </div> <script type="text/javascript"> $('img').error(function(){ this.src='http://javascript.ru/forum/images/smilies/sad.gif'; }); </script> </body> </html> |
Цитата:
Д-д-д-д-делай как я! (с) из песни Б.Титомира |
Ты бы ещё раз 10 открыл и закрыл документ, а потом бы дальше удивлялся почему jQuery нету в документе.
|
Цитата:
<script src="http://code.jquery.com/jquery-latest.js"></script> помогите, я ведь только учусь, ничего не понимаю пока что происходит |
Напишите код в блоке
// обработчик битых ссылок $(function(){ // тут }); |
Цитата:
|
Часовой пояс GMT +3, время: 15:38. |