Mark wrote:
The original code is:
%lt;input type='text' id='emListFull_imgsrc'/>
The code I want to replace with is:
<select id="emListFull_imgsrc">
<option value="cus94_1.png">Image 1</option>
<option value="cus94_2.png">Image 2</option>
<option value="cus94_3.png">Image 3</option>
</select>
I'm not a jsvascript programmer at all so thank you for any help,
That is not a good base to build on, is it? You should
definitely get yourself informed: <http://jibbering.com/faq/>
However, I take it that Developersdex's NNTP interface (AspNNTP 1.50)
which is known to be extremely buggy has escaped your valid markup
delimiters, therefore you probably want to replace
<input type='text' id='emListFull_imgsrc'/>
with
<select id="emListFull_imgsrc">
<option value="cus94_1.png">Image 1</option>
<option value="cus94_2.png">Image 2</option>
<option value="cus94_3.png">Image 3</option>
</select>
That would imply retrieving the reference to the `input' element with
var oInput = getElementById('emListFull_imgsrc');
or, if you knew the `form' element it is a descendant of:
var oInput = document.forms[...].elements['emListFull_imgsrc'];
Then build the `select' element:
var oSelect = document.createElement('select');
if (oSelect && oSelect.options)
{
oSelect.id = 'emListFull_imgsrc';
for (var i = 1; i < 4; i++)
{
oSelect.options[oSelect.options.length] =
new Option('cus94_' + i, 'Image ' + i);
}
}
and replace the `input' element with the `select' element:
oInput.parentNode.replaceChild(oSelect, oInput);
Be sure to do proper feature tests on run time before you use any feature
described here. <http://www.pointedears.de/scripts/test/whatami>, § 2.
HTH
PointedEars