Home > Web Front-end > JS Tutorial > If there is a picture in the specified position, the picture will be displayed, if there is no picture, the advertisement will be displayed. JS_advertising code

If there is a picture in the specified position, the picture will be displayed, if there is no picture, the advertisement will be displayed. JS_advertising code

WBOY
Release: 2016-05-16 18:25:39
Original
1373 people have browsed it

Because I use shtml, I used include directly in the page to load the advertisement. If you are interested in shtml, please see: shtml moving html
The same code is used to introduce js. img_failed.innerHTML = Just replace it with the JS you call later (not tested);
Also worth noting is that img_failed.innerHTML = The latter thing will directly display html. If your html has "(double) If quotation marks), please change it to '(single quotation marks), or just don't add it. Otherwise, problems will occur.
For details, you can compare the following two links:

Copy the code The code is as follows:




Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template