+ 2
How do I assign a name for the button? I'm trying to input a name and have the button display that name.
3 Réponses
+ 5
var s="";
for (var i=0; i<2; ++i) {
s2+=i+1;
s+=button(s2,l);
}
document.write(s);
function button(id,label) {
var s="<button id=\""+id+"\">";
s+=label+"</button>";
return s;
} var s2="b";
var l=prompt("Enter label:");
You can use it
+ 1
Thanks
0
Really? You can assign a value for a tag in js?