PDA

View Full Version : New Windows


robjime
02-09-2005, 09:29 PM
I want to, when the user clicks on a link open a window, which i was successful with, then the user inputs info into two boxes and when they click submit it put that info into a box on the parent page. Im having trouble with getting the boxes into the comment form. Heres my code:

Index.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Ipod Game</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function link(mypage,myname,w,h,features) {
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}
function insertlink(ltit, lurl) {
nlink = "<a href=" + ltit + ">" + lurl + "</a>";
document.fnote.content.value=document.fnote.content.value+nlink;
document.fnote.content.focus();
win.window.close();
}
</script>
</head>

<body>
<p><a href="#" onClick="link('link.htm', 'wlink', '325','125', '')">Link</a> <a href="#" onClick="link('song.htm', 'song', '325', '125', '')">Song</a>
</p>
<form name="fnote" method="post" action="">
<label>
<textarea name="content" id="content"></textarea>
</label>
</form>
<p>&nbsp; </p>
</body>
</html>


new window(link.htm)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Link</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="lform" >
<table width="300" height="97" border="0" cellspacing="1">
<tr bordercolor="#0066FF" bgcolor="#0066FF">
<td><font color="#FFFFFF">Link Url</font></td>
<td> <input type="ltitle" name="textfield">
browse</td>
</tr>
<tr bordercolor="#0066FF" bgcolor="#0066FF">
<td><font color="#FFFFFF">Link Text</font></td>
<td> <input type="ltext" name="textfield2"> </td>
</tr>
<tr bordercolor="#0066FF" bgcolor="#0066FF">
<td height="27" colspan="2"><div align="center">
<label>
<input type="submit" name="Submit" value="Go" onClick="insertlink(win.lform.ltitle.value, win.lform.ltitle.value)">
</label>
</div></td>
</tr>
</table>
</form>
</body>
</html>