Click to See Complete Forum and Search --> : Updating HTML


Rajinder Sodhi
04-11-2007, 04:51 PM
I want to try to update an html page by adding a certain tag <option> within a <select> tag. The code used below:

function showDuplicate() {

if (!newWin || newWin.closed){

newWin = window.open("https://ipp-uiuc.otm.uiuc.edu/greaser/keywords/duplicate.html","duplicateWindow","width=800,height=600,menubar=0,toolbar=0,location=0,directories=0,scrollbars=1");

storeValue(this.name);
newWin.focus();

currentSelection = this.name + "\n";
currentNumSelected++;

var ni = newWin.document.getElementById('DuplicateTest1');
var newOption = newWin.document.createElement('option');
newOption.innerHTML = this.name;
ni.appendChild(newOption);
}

else{

newWin.focus();


currentSelection = this.name + "\n";
currentNumSelected++;

var ni = newWin.document.getElementById('DuplicateTest');
var newOption = newWin.document.createElement('option');
newOption.innerHTML = this.name;
ni.appendChild(newOption);

}
}

var aAnchors = document.getElementsByTagName('a');
for(var i = 0; i < aAnchors.length; i++)
{
if(/^dup/.test(aAnchors[i].id)){
string = aAnchors[i].name;
if(i == 0 && i == 1)
alert(aAnchors[i].name);
aAnchors[i].addEventListener("click", showDuplicate, false);
}
}


The respective html code segment is:

<select id="DuplicateTest1" name="Enabled" size="5" multiple style="width: 100px;"></select>

<select name="Disabled" id="DuplicateTest" size="5" multiple style="width: 100px;">
</select>

This is a greasemonkey script that I'm working on and its just not updating the html file. All I want is for it to display the ids of the links that users have clicked on and I want it to display on an external html file called duplicate.html...

What am I doing wrong? Any help would be greatly appreciated.

Thanks