|
-
Jun 13th, 2008, 01:44 AM
#1
Thread Starter
Frenzied Member
How to send value of textbox input to popup window ?
Hi all i got a textbox and i allow the user enter some value and hit the submit. On submit i want that value be passed to javascript and that javascript opens a popup window along with that value. I have done most of the part only don't know how to pass value of text box to javascript on click of submit. I be happy if some one help with it.
Note : i don' want the form get redirected to new page !!
HTML Code:
<form method="POST" action="--WEBBOT-SELF--">
<input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
Code:
<script language="javascript">
function newWindow(url) {
var x,y;
x = screen.width-35;
y = screen.height-30;
var win = window.open(url,'glossaryWindow','toolbar=no,directories=no,width=500,height=500'+
'screenX=0,screenY=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');
}
// Start of Playme Function
function playme()
{
tempUrl ='';
url = '';
//alert(tempUrl);
url = "./player.php?songid=" + tempUrl.replace(/,$/,"");
newWindow(url);
return false;
}
// End of Playme Function
// -->
</script>
-
Jun 13th, 2008, 02:31 AM
#2
Re: How to send value of textbox input to popup window ?
In main page:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function newWindow(url) {
var x,y;
x = screen.width-35;
y = screen.height-30;
var win = window.open(url,'glossaryWindow','toolbar=no,directories=no,width=500,height=500'+
'screenX=0,screenY=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT TYPE="text" NAME="txtData" ID="txtData">
<INPUT TYPE="button" value="Click Me" onclick="Javascript: newWindow('popup.html');" >
</BODY>
</HTML>
In popup.html
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<INPUT TYPE="text" NAME="txtData2" ID="txtData2">
<SCRIPT LANGUAGE="JavaScript">
<!--
txtData2.value = window.opener.document.getElementById('txtData').value;
//-->
</SCRIPT>
</BODY>
</HTML>
-
Jun 13th, 2008, 02:42 AM
#3
Thread Starter
Frenzied Member
Re: How to send value of textbox input to popup window ?
Thanks for your help. But how to use that typed value inside popup window inside this code in the body part :
<param name="movie" value="mp3player.swf?file=test.php? Id=...
I want the input value to be placed at the end of Id= in the popup window!!
I know how to do it via post and get if the values were checkbox but in this case user types integers!!
Furthermore, is there away to use div window or dhtml window instead of popup window ?
I hope i be able to get help achiving this .thanks
-
Jun 13th, 2008, 03:02 AM
#4
Re: How to send value of textbox input to popup window ?
Well, looks like you are coding PHP. I don't know PHP, but in JSP I'll add the id after ? and use request.gatParameter() in popup.jsp. PHP must has something like that.
In plain HTML see if this works:
Inside <head>
Code:
<SCRIPT LANGUAGE="JavaScript">
<!--
function getParameter()
{
return "mp3player.swf?file=test.php?Id=" + window.opener.document.getElementById('txtData').value;
}
//-->
</SCRIPT>
In body:
Code:
<param name="movie" value="javascript: getParameter();" >
-
Jun 13th, 2008, 03:14 AM
#5
Re: How to send value of textbox input to popup window ?
or a simple document.write may work;
In <body>
Code:
<SCRIPT LANGUAGE="JavaScript">
document.write("<param name='movie' value='" + "mp3player.swf?file=test.php?Id=" + window.opener.document.getElementById('txtData').value + "' >");
</SCRIPT>
-
Jun 13th, 2008, 04:50 PM
#6
Re: How to send value of textbox input to popup window ?
If it's a popup window, use window.opener.document.getElementById('someHiddenField').value and set the value to what the user entered in the textbox in the popup window. Then you can do what's in #5 by concatenating the values.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|