File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,23 @@ <h1>What to buy</h1>
59
59
/*for(var i=0; i < items.length; i++){
60
60
alert(typeof items[i])
61
61
}*/
62
+ /*var paras = document.getElementsByTagName("p");
63
+ for(var i=0; i < paras.length; i++){
64
+ var title_text = paras[i].getAttribute("title");
65
+ if(title_text) alert(title_text)
66
+ //alert(paras[i].getAttribute("title"));
67
+ }*/
68
+ /*var shopping = document.getElementById("purchases");
69
+ alert(shopping.getAttribute("title"));
70
+ shopping.setAttribute("title", "a list of goods");
71
+ alert(shopping.getAttribute("title"));*/
62
72
var paras = document . getElementsByTagName ( "p" ) ;
63
73
for ( var i = 0 ; i < paras . length ; i ++ ) {
64
74
var title_text = paras [ i ] . getAttribute ( "title" ) ;
65
- if ( title_text != null ) {
66
- alert ( title_text )
75
+ if ( title_text ) {
76
+ paras [ i ] . setAttribute ( "title" , "brand new title text" ) ;
77
+ alert ( paras [ i ] . getAttribute ( "title" ) ) ;
67
78
}
68
- //alert(paras[i].getAttribute("title"));
69
79
}
70
80
71
81
</ script >
You can’t perform that action at this time.
0 commit comments