- 1
How to change source attribute
Dom
10 ответов
0
Var arr = document
getElementByTagName (" _ ");for(Var x = O;x <arr._;x++){ arr[x]._="demo.jpg";
+ 1
Well just change the link?
+ 1
You mean in DOM?
+ 1
Yeah
+ 1
if you want reference then see the javascript changing element in DOM
+ 1
var arr = document.getElementsByTagName("img");
for(var x=0; x<arr.length; x++) {
arr[x].src= "demo.jpg";
}
0
How
0
First you have to give an id to the tag then make an object to it and then you can change the source link for example if i have an id called "link" then
var changed = document.getElementById("link")
changed.src = "some_other_link"
0
Changing it by tag name
0
Then
var changed = document.getElementByTag("Tag")
changed.src = "some_other_link"
Use this only when there is only one type if that tag