postioning an ajax pop up form ?

Hi, I have a php form uses some ajax/javascript. This php form has several rows of subscriber data.Each row having a unique account number. I have a check box at the end of each row and when this is clicked I have a ajax input form that pops up for the user to add some notes. I need to know how I can position this ajax input form. As of now the postion of the inputo form is defined within the div tags as show below, but the problem is that if the user scrolls down the page and accesses the last row in the column and clicks to add some notes the ajax input window is displayed out side the viewable area
and the user needs to scroll up to add the notes. How can I postion the ajax pop up form with reference to the active window?
My positioning is done as follows:
<div id="formDiv" style="width: 50%;  margin: 0 auto; padding: 10px; background-color: #ccff99;  text-align: center; z-index: -1; position: absolute; top: 70px; left: 250px; border: solid 10px #cc6600; font-weight: bold; display: none;"> <h3>Notes</h3>

******MY AJAX CODE IS AS FOLLOWS***************
 
<script type="text/javascript">
function doForm(tempval) {
	var win = window.
	document.getElementById('formDiv').style.zIndex = "100";
	document.getElementById('formDiv').style.display = "";
	document.getElementById('body').style.backgroundColor = "#000000";
	document.getElementById('button1').style.visibility = "visible";
	document.getElementById('acnum').value=tempval;
 
}
function clearForm(frm) {
	frm.acnum.value=document.getElementById('button1').value;
	frm.date.value=document.getElementById('date').value;;
	frm.CSR.value=0;
	frm.notes.value='';
}
function quitForm(frm) {
	document.getElementById('formDiv').style.zIndex = "-1";
	document.getElementById('formDiv').style.display = "none";
	document.getElementById('body').style.backgroundColor = "#CC9966";
	document.getElementById('button1').style.visibility = "visible";
	clearForm(frm);
}
function buildForm(frm) {
	if (frm.CSR.value != '0') {
		var str = "acnum=" + frm.acnum.value;
		str += "&date=" + frm.date.value;
		str += "&csr=" + frm.CSR.value;
		str += "&notes=" + frm.notes.value;
		return str;
		quitForm();
		
//		alert(str); // for testing
//		return false;
	} else return false;
}
function sendForm(obj) {
	var xmlHttp = null;
	var cont = document.getElementById('links');
	var frmInfo = buildForm(obj);
	if (!frmInfo) {
		alert("Pls choose a CSR!");
		return false;
	}
	xmlHttp = GetXmlHttpObject(stateChanged);
	xmlHttp.open("POST", "update_notes.php", false);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
	xmlHttp.send(frmInfo);
	cont.innerHTML += xmlHttp.responseText;
	quitForm(obj);
}
function GetXmlHttpObject(handler) {
	var objXmlHttp=null;
	try	{  // Firefox, Opera 8.0+, Safari
		objXmlHttp=new XMLHttpRequest();
		objXmlHttp.onreadystatechange=handler
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler
	}
	catch (e) {  // Internet Explorer
		try {
			objXmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			objXmlHttp.onreadystatechange=handler
		}
		catch (e) {
			objXmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			objXmlHttp.onreadystatechange=handler
		}
	}
	return objXmlHttp;
}
function stateChanged() {
	try {
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			return xmlHttp.responseText;
		}
	}
	catch (e) {
	}
}
</script>

Open in new window

aej1973Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hube02Commented:
I think you can position the form div absolutely using the style properties position, top & left

document.getElementById('formDiv').style.position = 'absolute';
document.getElementById('formDiv').style.top = '10px;'
document.getElementById('formDiv').style.left = '10px;'
0
aej1973Author Commented:
That doesn't seem to work. The popup is displayed after the last row.
0
Hube02Commented:
What does the HTML part of the page look like, meaning, where is <div id="formDiv">

Is it located inside another division that is absolutely positioned? Try placing this division as the fist thing on the page. You can also try using a style in the division itself to position it.

<div id="formDiv" style="position:absolute;top=10px;left=10px;">

But absolute positioning from the document origin will only happen if this division is not inside another division that is either absolutely or relatively poitioned.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Hube02Commented:
Here is an example html document with javascript that positions a div element absolutely.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
  </head>
  <body>
    <div id="formDiv" style="border:1px solid #000; width: 100px; height: 100px;"></div>
    <script type="text/javascript">
      document.getElementById('formDiv').style.position = "absolute";
      document.getElementById('formDiv').style.top = "300px";
      document.getElementById('formDiv').style.left = "300px";
    </script>
  </body>
</html>

Open in new window

0
aej1973Author Commented:
this is not working.  I feel the positioning will need to be with reference to the active window.

A
0
Hube02Commented:
From what I can see of your code the window that you are talking about is just a division within the current page that is made visible. If this is the case then you should be able to position that division anywhere within the browser window using absolute positioning, unless, like I said above, that division is inside another division or page element that is itself absolutely or relatively positioned. If this is the case it can still be done, but you would need to use a negative in the top setting to move the element up the page from it's current position.

If this is not the case, then I don't understand what it is that you are doing and it may be beyond my abilities to assist you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aej1973Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Applications

From novice to tech pro — start learning today.