Home>Article>Web Front-end> How to change src path in JavaScript
How to change the src path in JavaScript: 1. Use the src attribute of the element object, the syntax "element object.src="new path address";"; 2. Use the setAttribute() method, the syntax "element object. setAttribute("src","new path address");".
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
JavaScript to change the src path
Method 1: Use the src attribute of the element object
Method 2: Using the setAttribute() method
[Related recommendations:javascript learning tutorial】
The above is the detailed content of How to change src path in JavaScript. For more information, please follow other related articles on the PHP Chinese website!