Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does javascript change the link address of the picture?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "javascript how to change the picture link address", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "javascript how to change the picture link address" bar!

The method for javascript to change the link address of a picture: [_ window.onload = function () {ImageSrc ();} function ImageSrc () {var imgs = document.getEleme...].

This article operating environment: windows10 system, javascript 1.8.5, thinkpad T480 computer.

How to change the link address of a picture by JavaScript:

_ window.onload = function () {ImageSrc ();} function ImageSrc () {var imgs = document.getElementsByClassName ("ArticleBody") [0] .getElementsByTagName ("img"); for (var I = 0, l = imgs.length; I

< l; i++) { imgs[i].src = imgs[i].src.replace("gjbt", "www"); //img[i].src is the reference to the image. } }

Thank you for your reading, the above is the content of "javascript how to change the picture link address", after the study of this article, I believe you have a deeper understanding of how to change the picture link address of javascript, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report