immrama87
15 Dec 2010, 05:03 PM
Currently I am working with a product that builds and maintains help desk webpages and then automatically submits tickets to and from either an MSSQL or an Oracle database. Unfortunately, it was not designed very well on the web dev end and creates every element (even your most basic <p> tags) within a pair of <div> tags. The id's for these <div>s are automatically set by the program based on the element type and the algorithmically-set database instance ID. This poses an obvious web development problem when it comes to CSS, but fortunately you can set the label attribute from within this program, which brings me to my question...
These pages are all based on the same .jsp with proprietary beans used to create the page's elements. My thought was to add a JavaScript to the <head> of the document that looks like this:
var divs[] = document.getElementByTagName('div');
for(var i=0;i<divs.length;i++){
divs[i].setAttribute('id', divs[i].getAttribute('label'));
}
to replace the program-generated div id's with the labels that I have set myself. This isn't working, at least not with this code, so any suggestions would be greatly appreciated.
Thanks,
-James
These pages are all based on the same .jsp with proprietary beans used to create the page's elements. My thought was to add a JavaScript to the <head> of the document that looks like this:
var divs[] = document.getElementByTagName('div');
for(var i=0;i<divs.length;i++){
divs[i].setAttribute('id', divs[i].getAttribute('label'));
}
to replace the program-generated div id's with the labels that I have set myself. This isn't working, at least not with this code, so any suggestions would be greatly appreciated.
Thanks,
-James