Get the App
SLTechnology News&Howtos  ›  Development  › 

How does javascript change the link address of the picture?

Shulou Source: shulou.com Published: 2022-06-02 16:44:34 11月25日 Update

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!

Tags: Pictures addresses links learning content methods that is ideas situations articles more environment computers knowledge knowledge points articles systems follow questions practice Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Microsoft macOS Redmi Docker