hi there i making a div based alert and for that i want to make a button in side a div that could close that div too i know that is not a big case but some how i am making some kind of mistake the function msg_divs() is called if the form validation is not successful and throws th errors inside the div and after that it makes a button and that calls a function close_msg_div() that clears the innerHTML of he "error" div but here is the error when i try to clear that div i think that i am not concatinating the function in the "onclick property" of the close button ,some times it gives
"syntax error close_msg_divs( "
and some times
"error is not defined
onclick(click clientX=726, clientY=177)Lwd K62pz...YfA%3D% 3D (line 2)
[Break on this error] close_msg_divs( error);"
thanks for any help in advance here is the source
[code=javascript]
function msg_divs(hldr,x ,y,w,h,data){// description of the arguments below
alert(hldr);
holder=document .getElementById (hldr); //wrap around div
holder.innerHTM L="";
holder.style.vi sibility='visib le';
holder.style.di splay='block'; // the div gets styled
holder.style.po sition='absolut e';
holder.style.le ft=x;
holder.style.to p=y;
holder.style.wi dth=w;
holder.innerHTM L=data;
holder.innerHTM L+="<input name='close' id='close' type='button' value='lose' class='button' onclick='close_ msg_divs("+hldr +")' />";
alert(holder.in nerHTML);
}
function close_msg_divs( obj){
alert(obj);
document.getEle mentById(obj).i nnerHTML='';
holder.style.vi sibility='hidde n';
}
[/code]
[code=html]
<div id="error" class='error'></div>
[/code]
"syntax error close_msg_divs( "
and some times
"error is not defined
onclick(click clientX=726, clientY=177)Lwd K62pz...YfA%3D% 3D (line 2)
[Break on this error] close_msg_divs( error);"
thanks for any help in advance here is the source
[code=javascript]
function msg_divs(hldr,x ,y,w,h,data){// description of the arguments below
alert(hldr);
holder=document .getElementById (hldr); //wrap around div
holder.innerHTM L="";
holder.style.vi sibility='visib le';
holder.style.di splay='block'; // the div gets styled
holder.style.po sition='absolut e';
holder.style.le ft=x;
holder.style.to p=y;
holder.style.wi dth=w;
holder.innerHTM L=data;
holder.innerHTM L+="<input name='close' id='close' type='button' value='lose' class='button' onclick='close_ msg_divs("+hldr +")' />";
alert(holder.in nerHTML);
}
function close_msg_divs( obj){
alert(obj);
document.getEle mentById(obj).i nnerHTML='';
holder.style.vi sibility='hidde n';
}
[/code]
[code=html]
<div id="error" class='error'></div>
[/code]
Comment