above code also come from formPost method, in above code script part run by paseScript function which is checked by firebug and it run smoothly but problem is when i click on submit button v is undefined
function formPost(strURL, v) {
if(v)
if(!v.exec())
return;
var xmlHttpReq = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
updatepage(self.xmlHttpReq.responseText); //,responsediv); //Text,responsediv);
}else{
updatepage(responsemsg,responsediv);
}
}
self.xmlHttpReq.send();
}
function updatepage(text){
document.getElementById(id).innerHTML = parseScript(text);
}
function parseScript(strcode) {
/*
www.webdeveloper.com */
var scripts = new Array(); // Array which will store the script's code
// Strip out tags
while(strcode.indexOf("<script") > -1 || strcode.indexOf("</script") > -1) {
var s = strcode.indexOf("<script");
var s_e = strcode.indexOf(">", s);
var e = strcode.indexOf("</script", s);
var e_e = strcode.indexOf(">", e);
// Add to scripts array
scripts.push(strcode.substring(s_e+1, e));
// Strip from strcode
strcode = strcode.substring(0, s) + strcode.substring(e_e+1);
}
// Loop through every script collected and eval it
for(var i=0; i<scripts.length; i++) {
try {
var scr = scripts[i].trim();
eval(scr);
}
catch(ex) {
// do what you want here when a script fails
}
}
}