Post by iPokemon on Sept 10, 2011 14:28:48 GMT -5
Code Name: Javascript DOM Namer
Crossbrowser: Yes
Description:
This script will give id's to every element that you specify, for easy access later on.
It is suggested to complete all boards and categories and side tables and things before inserting and using this code, since it will change every time something is changed too.
Global Footer
To Edit:
var ele = [
[document.getElementsByTagName("td"),"td"],
[document.getElementsByTagName("tr"),"tr"],
[document.getElementsByTagName("table"),"table"],
[document.getElementsByTagName("b"),"b"],
[document.getElementsByTagName("a"),"a"],
[document.getElementsByTagName("font"),"font"],
[document.getElementsByTagName("element"),"name"]
];
No comma on last element.
Crossbrowser: Yes
Description:
This script will give id's to every element that you specify, for easy access later on.
It is suggested to complete all boards and categories and side tables and things before inserting and using this code, since it will change every time something is changed too.
Global Footer
<script type="text/javascript"><!--
/*
Javascript DOM Namer
by iPokemon
http://bytemecodes.proboards.com/
Copyright 2011
Do not repost or claim as own
*/
var ele = [
[document.getElementsByTagName("td"),"td"],
[document.getElementsByTagName("tr"),"tr"],
[document.getElementsByTagName("table"),"table"],
[document.getElementsByTagName("b"),"b"],
[document.getElementsByTagName("a"),"a"],
[document.getElementsByTagName("font"),"font"]
];
for(x=0;x<ele.length;x++){
var element = ele[x][0];
var name = ele[x][1];
for(z=0;z<element.length;z++){
var test = document.getElementById(element[z].id);
if(!test){
element[z].setAttribute('id',name+z);
}
}
}
//--></script>
To Edit:
var ele = [
[document.getElementsByTagName("td"),"td"],
[document.getElementsByTagName("tr"),"tr"],
[document.getElementsByTagName("table"),"table"],
[document.getElementsByTagName("b"),"b"],
[document.getElementsByTagName("a"),"a"],
[document.getElementsByTagName("font"),"font"],
[document.getElementsByTagName("element"),"name"]
];
No comma on last element.