Anda di halaman 1dari 2

<script type="text/javascript">

var debug = 0; // set debug variable


if (debug === 1) { document.write("Started addResetButton"+"<BR>");}

var as = document.getElementsByTagName('a');
if (debug === 1) { document.write("Got the anchors"+"<BR>");}

if (debug === 1) { document.write("Loop over the anchors"+"<BR>");}


for(var a = 0; a < as.length; a++){
if(as[a].innerHTML != "Go"){
continue;
}

if (debug === 1) { document.write("Found the go button"+"<BR>");}

var new_a = document.createElement('a');


if (debug === 1) { document.write("Created the new anchor"+"<BR>");}

var new_span = document.createElement('span');


if (debug === 1) { document.write("Created the Span element"+"<BR>");}

var new_td = document.createElement('td');


if (debug === 1) { document.write("Created the TD element"+"<BR>");}

var new_func = new Function ("return


PersonalizationEditor.removeDefaultSelection(false);");
if (debug === 1) { document.write("Created the new function"+"<BR>");}

var node = as[a].parentNode; // move to SPAN


if (debug === 1) { document.write("set node to anchor's span:
"+node.tagName+"<BR>");}

node = node.parentNode; // move to TD


if (debug === 1) { document.write("Set node to the TD:
"+node.tagName+"<BR>");}

node = node.parentNode; // move to TR


if (debug === 1) { document.write("Set node to the TR:
"+node.tagName+"<BR>");}

new_td.className = "XUIPromptEntry";
if (debug === 1) { document.write("Set the td class name"+"<BR>");}

new_span.className = "minibuttonOn";
if (debug === 1) { document.write("Set the span class name"+"<BR>");}

new_a.innerHTML = "Reset";
if (debug === 1) { document.write("Set the inner HTML to reset"+"<BR>");}

new_a.href ="#";
if (debug === 1) { document.write("Set the href=#"+"<BR>");}

new_a.onclick = new_func;
if (debug === 1) { document.write("Set the onclick to the
new_func"+"<BR>");}

new_span.appendChild(new_a);
if (debug === 1) { document.write("Appended anchor to the span"+"<BR>");}
new_td.appendChild(new_span);
if (debug === 1) { document.write("Appended span to the td"+"<BR>");}

node.appendChild(new_td);
if (debug === 1) { document.write("Appended the td to the tr"+"<BR>");}

break;
}

if (debug === 1) { document.write("Finished addResetButton"+"<BR>");}


</script>

Anda mungkin juga menyukai