Insert multiple attributes into html tag using JavaScript and not between tags

djdixie2009

New Member
From a previous quest we asked about inserting a new attribute into a html tag and the code below does the job nicely, but how should it be coded to add multiple attributes, for example changing..\[code\]<body bgcolor="#DDDDDD">\[/code\]to...\[code\]<body bgcolor="#DDDDDD" topmargin="0" leftmargin="0"> \[/code\]The code that works for a single attribute is...\[code\]document.getElementsByTagName("body")[0].setAttribute("id", "something");\[/code\]How to modify this for inserting multiple attributes?
 
Back
Top