R
.rhavin grobert
<html><head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript" >
//
-----------------------------------------------------------------------
function test()
{
// basically, this fn parses for 'qsel'-tags (a placeholder) and
// *should* replace them whith a div-contianer containing another
// div and a select-element. to see whats going on, we fill the
// textarea with the result of that process and also do some fancy
// coloring to show the ** THREE ** (!?!) divs resulting.
var qualsGroup = document.getElementsByTagName("qsel");
var cnt = qualsGroup.length;
while (cnt-->0)
{
var qid = qualsGroup[cnt].id;
var parent = qualsGroup[cnt].parentNode;
var zIndex = qualsGroup[cnt].zIndex;
// to free the id, we remove the placeholder
parent.removeChild(qualsGroup[cnt]);
// we set up a new selector with the dummys id
// and fill it with a test-option.
var qsel = document.createElement('select');
qsel.name = qid;
qsel.id = qid;
qsel.zIndex = zIndex + 1;
var opt = new Option;
opt.value = '1';
opt.text = 'test-1';
qsel.options[0] = opt;
qsel.style.background = 'transparent';
qsel.style.width = '400px';
// this is our container-div; it should contain one
// additional div and a selector
var qselCont = document.createElement('div');
qselCont.style.display = 'inline';
qselCont.style.border = '2px solid #00f';
qselCont.style.padding = '10px';
qselCont.style.background = '#555';
qselCont.zIndex = zIndex;
qselCont.id = qid + '_c';
// this is the other div inside the container
var qselFlow = document.createElement('div');
qselFlow.style.border = '1px solid #f00';
qselFlow.style.width = '80px';
qselFlow.style.height = '40px';
qselFlow.style.background = '#77F';
qselFlow.id = qid + '_f';
// now we append the flow-div and the selector
// to our container-div
qselCont.appendChild(qselFlow);
qselCont.appendChild(qsel);
// and append our container to the parent
// of our placeholder
parent.appendChild(qselCont);
}
// we fill the textarea with the resulting html
document.getElementById('rs').value =
document.body.parentNode.innerHTML;
return true;
}
</script>
</head><body onload="test()">
<p>test a1 <qsel id="a1" /></p>
<textarea id="rs" cols="100" rows="50"></textarea>
</body><html>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript" >
//
-----------------------------------------------------------------------
function test()
{
// basically, this fn parses for 'qsel'-tags (a placeholder) and
// *should* replace them whith a div-contianer containing another
// div and a select-element. to see whats going on, we fill the
// textarea with the result of that process and also do some fancy
// coloring to show the ** THREE ** (!?!) divs resulting.
var qualsGroup = document.getElementsByTagName("qsel");
var cnt = qualsGroup.length;
while (cnt-->0)
{
var qid = qualsGroup[cnt].id;
var parent = qualsGroup[cnt].parentNode;
var zIndex = qualsGroup[cnt].zIndex;
// to free the id, we remove the placeholder
parent.removeChild(qualsGroup[cnt]);
// we set up a new selector with the dummys id
// and fill it with a test-option.
var qsel = document.createElement('select');
qsel.name = qid;
qsel.id = qid;
qsel.zIndex = zIndex + 1;
var opt = new Option;
opt.value = '1';
opt.text = 'test-1';
qsel.options[0] = opt;
qsel.style.background = 'transparent';
qsel.style.width = '400px';
// this is our container-div; it should contain one
// additional div and a selector
var qselCont = document.createElement('div');
qselCont.style.display = 'inline';
qselCont.style.border = '2px solid #00f';
qselCont.style.padding = '10px';
qselCont.style.background = '#555';
qselCont.zIndex = zIndex;
qselCont.id = qid + '_c';
// this is the other div inside the container
var qselFlow = document.createElement('div');
qselFlow.style.border = '1px solid #f00';
qselFlow.style.width = '80px';
qselFlow.style.height = '40px';
qselFlow.style.background = '#77F';
qselFlow.id = qid + '_f';
// now we append the flow-div and the selector
// to our container-div
qselCont.appendChild(qselFlow);
qselCont.appendChild(qsel);
// and append our container to the parent
// of our placeholder
parent.appendChild(qselCont);
}
// we fill the textarea with the resulting html
document.getElementById('rs').value =
document.body.parentNode.innerHTML;
return true;
}
</script>
</head><body onload="test()">
<p>test a1 <qsel id="a1" /></p>
<textarea id="rs" cols="100" rows="50"></textarea>
</body><html>