Re: Loop Quirk???

"Leander Gillard" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <00dd01c58e23$657fefd0$6664a8c0@vianet2pksckv>
Ok, here goes, the onChange event kick starts the request to a perl script 
which sends back the data to for innerHTML and targets the <DIV 
id="select">.  This works np in FF.

Thanks in advance.

--Leander

JS:

function loadXMLDoc(url, x_name, rmode) {
// Internet Explorer
try { this.req = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e) {
try { this.req = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(oc) { req = null; }
}
// Mozailla/Safari
if (!req && typeof XMLHttpRequest != "undefined") { req = new 
XMLHttpRequest(); }
// Call the processChange() function when the page has loaded
if (req != null) {
name = x_name;
req.open("POST", url, true);
req.send(rmode);

req.onreadystatechange = self.processChange;

}

}
function processChange() {

// The page has loaded and the HTTP status code is 200 OK
if (req.readyState == 4 && req.status == 200) {
t = window.req.responseText;

// when equal to 2 it will return a 1 x 2 array
if((t.charAt(0)) == 2){

info = t.split(",,,");

//Need to add a method to clear divs leftover from other actions
window.redir(info[1], info[2], info[3]);


}else if((t.charAt(0)) == 1){
// when equal to 1 it will return a 1 x 4 array

info = t.split(",,,");

window.getObject(name).innerHTML = info[1];


}else if((t.charAt(0) != 1) && (t.charAt(0) != 2)){

window.getObject(name).innerHTML = t;


}
}


}

function getObject(name) {
var ns4 = (document.layers) ? true : false;
var w3c = (document.getElementById) ? true : false;
var ie4 = (document.all) ? true : false;

if (ns4) return document[name];
if (ie4) return document.all[name];
if (w3c) return document.getElementById(name);
return false;
}

function redir(script, location, rm){
loadXMLDoc(script,location,rm);

}


HERE IS THE TMPL

<TMPL_LOOP NAME="add_loop">
<tr bgcolor="E8EEF7" onmouseover="ChangeColor(this, true);" 
onmouseout="ChangeColor(this, false);">
<td width="15" height="10" >
<div align="center">
<input type="checkbox" name="<TMPL_VAR ESCAPE=HTML NAME="check">">
</div></td>
<td><select name="<TMPL_VAR ESCAPE=HTML NAME="cid">" onChange="var 
params='cid=' + window.document.add_account.<TMPL_VAR ESCAPE=HTML 
NAME="cid">.value + '&amp;rm=mode_205'; var 
target=window.document.add_account.<TMPL_VAR ESCAPE=HTML 
NAME="domain_target">.name; window.redir('index.cgi','select', params);" >
<TMPL_VAR NAME="cid_info">
</select></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="fname">" type="text" size="8">
</div></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="lname">" type="text" size="8">
</div></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="uname">" type="text" size="8">
</div></td>
<td><div id="select"><select id="<TMPL_VAR ESCAPE=HTML NAME="dom_id">" 
name="<TMPL_VAR ESCAPE=HTML NAME="dom_id">">
<TMPL_VAR NAME="domain_info">
</select></div></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="e_quota">" type="text" size="8">
</div></td>
</tr>
<tr onmouseover="ChangeColor(this, true);" onmouseout="ChangeColor(this, 
false);">
<td width="15" height="10" >
<div align="center">
<input type="checkbox" name="<TMPL_VAR ESCAPE=HTML NAME="check_alt">">
</div></td>
<td><select name="<TMPL_VAR ESCAPE=HTML NAME="cid_alt">" onChange="var 
params='cid=' + window.document.add_account.<TMPL_VAR ESCAPE=HTML 
NAME="cid">.value + '&amp;rm=mode_205'; var 
target=window.document.add_account.<TMPL_VAR ESCAPE=HTML 
NAME="domain_target_alt">.name; window.redir('index.cgi',target, params);" >
<TMPL_VAR NAME="cid_info">
</select></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="fname_alt">" type="text" size="8">
</div></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="lname_alt">" type="text" size="8">
</div></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="uname_alt">" type="text" size="8">
</div></td>
<td><select id="<TMPL_VAR ESCAPE=HTML NAME="dom_id_alt">" name="<TMPL_VAR 
ESCAPE=HTML NAME="dom_id_alt">">
<TMPL_VAR NAME="domain_info">
</select></td>
<td nowrap><div align="center">
<input name="<TMPL_VAR ESCAPE=HTML NAME="e_quota_alt">" type="text" 
size="8">
</div></td>
<td height="10" ></td>
</tr>
</TMPL_LOOP>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.