Hello, kees!:
I think this is what you are looking for, here is the sample code,
be careful when copying and pasting with word wrapping:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_openBrWindow(divname,winName,features,curvalue) { //v2.0
w=window.open('',winName,features);
w.document.write('<form name="form1" method="post" action="">');
w.document.write('<input type="text" name="textfield"
value="'+curvalue+'"><br>');
w.document.write('<input type="button" value="Press here"
onClick="window.opener.document.getElementById(\''+divname+'\').innerHTML=form1.textfield.value;
window.close();">');
w.document.write('</form>');
w.document.close();
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="400" border="2" cellspacing="0" cellpadding="0">
<tr>
<td><a href="javascript:MM_openBrWindow('text1','popup','width=200,height=100',document.getElementById('text1').innerHTML)">Arrival</a>
</td>
<td><div id="text1">This is a text to test</div></td>
</tr>
<tr>
<td><a href="javascript:MM_openBrWindow('text2','popup','width=200,height=100',document.getElementById('text2').innerHTML)">Departure</a></td>
<td><div id="text2">This is a second text to test</div></td>
</tr>
</table>
<p> </p>
</body>
</html>
How it works?, it's really easy, the links call a javacript function
called MM_openBrWindow:
function MM_openBrWindow(divname,winName,features,curvalue) { //v2.0
w=window.open('',winName,features);
w.document.write('<form name="form1" method="post" action="">');
w.document.write('<input type="text" name="textfield"
value="'+curvalue+'"><br>');
w.document.write('<input type="button" value="Press here"
onClick="window.opener.document.getElementById(\''+divname+'\').innerHTML=form1.textfield.value;
window.close();">');
w.document.write('</form>');
w.document.close();
}
The first parameter is the name of the div tag which holds the text to
be edited, the second is the name of the new window, the third, the
features of the window (border, status, etc) and the fourth is the
current value for the div tag.
This function, creates a new window and writes a simple form inside
it, with an input field and a button. When the button is pressed, it
changes the div.innerHTML property to be the same as the textfield and
closes the window.
I think you can easily adapt it to fit your needs, but don't hesitate
to request for any help! ;-)
I have tested it on IE and Mozilla, and it works well, but if you want
something else just ask, we are here to help you-
Regards. |