473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

passing values

I have this home.js file and I'm trying to collect the values on the
other at "emplist.aspx"
function poponload()
{
testwindow= window.open ("emplist.aspx", "mywindow",
"location=1,status=1,scrollbars=1,width=600,height =600");
testwindow.moveTo(0,0);
}

document.write ("<form action=http://www.espn.com method=post>")
document.write ("<input type=text>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")

but I don't know how to retrieve the values in the emplist.aspx page.
the page opens but I can't retrieve the values.

Apr 5 '07 #1
6 18283
On Apr 5, 3:40 pm, vnc...@hotmail.com wrote:
I have this home.js file and I'm trying to collect the values on the
other at "emplist.aspx"

function poponload()
{
testwindow= window.open ("emplist.aspx", "mywindow",
"location=1,status=1,scrollbars=1,width=600,height =600");
testwindow.moveTo(0,0);

}

document.write ("<form action=http://www.espn.commethod=post>")
document.write ("<input type=text>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")

but I don't know how to retrieve the values in the emplist.aspx page.
the page opens but I can't retrieve the values.
not 100% sure what you mean, but it sounds like you're trying to get
two windows to talk to each other.

the original window has access to the window it opened via the
testwindow variable. the problem is, you dont really know when that
window is done loading, so you cant except code you put in the next
line after "testwindow= window.open..." to be working with the fully-
loaded emplist.aspx

what i usually do is have the window that popped tell the original
window that it's done loading. to do that, add this line of code after
the window.open():
testwindow.opener = window;

then the javascript code in your emplist.aspx page will have access to
the original window by using window.opener. so if you had a function
called foo() in your original file, your emplist.aspx file could call
that function by calling window.opener.foo()

you could either have emplist.aspx send data to the original file
through a parameter to a function like foo(), or you could just use
foo() as a sort-of checkpoint that tells the original file that
emplist.aspx is done loading and you can start getting data from it.

Apr 5 '07 #2
thanks for responding...
I'm trying to pass.....

emplist.aspx?Fname=form.fname

to another page.

function poponload()
{
testwindow= window.open ("http://amp/emplist.aspx?Fname=form.fname",
"mywindow",
"location=1,status=1,scrollbars=1,width=600,height =600");
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")
On Apr 5, 4:00 pm, brunascle.m...@gmail.com wrote:
On Apr 5, 3:40 pm, vnc...@hotmail.com wrote:


I have this home.js file and I'm trying to collect the values on the
other at "emplist.aspx"
function poponload()
{
testwindow= window.open ("emplist.aspx", "mywindow",
"location=1,status=1,scrollbars=1,width=600,height =600");
testwindow.moveTo(0,0);
}
document.write ("<form action=http://www.espn.commethod=post>")
document.write ("<input type=text>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")
but I don't know how to retrieve the values in the emplist.aspx page.
the page opens but I can't retrieve the values.

not 100% sure what you mean, but it sounds like you're trying to get
two windows to talk to each other.

the original window has access to the window it opened via the
testwindow variable. the problem is, you dont really know when that
window is done loading, so you cant except code you put in the next
line after "testwindow= window.open..." to be working with the fully-
loaded emplist.aspx

what i usually do is have the window that popped tell the original
window that it's done loading. to do that, add this line of code after
the window.open():
testwindow.opener = window;

then the javascript code in your emplist.aspx page will have access to
the original window by using window.opener. so if you had a function
called foo() in your original file, your emplist.aspx file could call
that function by calling window.opener.foo()

you could either have emplist.aspx send data to the original file
through a parameter to a function like foo(), or you could just use
foo() as a sort-of checkpoint that tells the original file that
emplist.aspx is done loading and you can start getting data from it.- Hide quoted text -

- Show quoted text -

Apr 6 '07 #3
Ok, I'm making some headway with

urlStr = "http://amp/emplist.aspx?Fname="+document.form.fname,
"mywindow","location=1,status=1,scrollbars=1,width =600,height=600";
function poponload()
{

testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")
but I'm getting this.... "document.form.fname is null or not an
object!!!

Assistance???
Thanks,

Apr 6 '07 #4
Lee
vn****@hotmail.com said:
>
Ok, I'm making some headway with

urlStr = "http://amp/emplist.aspx?Fname="+document.form.fname,
"mywindow","location=1,status=1,scrollbars=1,widt h=600,height=600";
function poponload()
{

testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")
but I'm getting this.... "document.form.fname is null or not an
object!!!
I don't think you're really making much headway.
You're getting that error because document.form.fname doesn't exist
at the time that you're trying to concatenate it into your urlStr
variable. If it did exist, it wouldn't be a string, so it doesn't
really make any sense to try to append it to the URL, anyway.

Why are you using document.write() to create a form that doesn't
have any dynamic content? Why not just use simple HTML?

If the window that opens your emplist.aspx page contains a form
named "fname", then the emplist.aspx page can access that form as:
window.opener.forms["fname"]
You don't need to pass anything to the new page for that to work.
If you need to pass it the name of the form, then you need to pass
the *name*, not a reference to the form.
--

Apr 6 '07 #5
The reason I'm using document.write() is because I'm using Team
Services to create these online resources and the only way to post
values from a form is to use JavaScript. The old fashion

<form>
<input type>
<input type=submit>

doesn't work.

http://blahblah/test.html?fname=
I keep getting undefined...
function poponload()
{

if (document.forms['fname'] != null)
{
urlStr = "http://192.168.14.13/test.html?
fname="+document.forms['fname'],
"mywindow","location=1,status=1,scrollbars=1,width =100,height=100";
}
else
{
urlStr = "http://192.168.14.13/test.html?
fname=1",
"mywindow","location=1,status=1,scrollbars=1,width =100,height=100";
}

testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")

Apr 9 '07 #6
Lee
vn****@hotmail.com said:
>
The reason I'm using document.write() is because I'm using Team
Services to create these online resources and the only way to post
values from a form is to use JavaScript. The old fashion

<form>
<input type>
<input type=submit>

doesn't work.

http://blahblah/test.html?fname=
I keep getting undefined...
function poponload()
{

if (document.forms['fname'] != null)
{
urlStr = "http://192.168.14.13/test.html?
fname="+document.forms['fname'],
Again, you do not want to append document.forms['fname'] to your URL.
You're trying to append a reference to the form where you seem to
want to append *the name* of the form.

After finally actually looking at your poponload() function,
it doesn't really make any sense. You're trying to create
urlStr as a triple of comma-separated values.

function poponload()
{
if (document.forms['fname'] != null)
{
urlStr = "http://192.168.14.13/test.html?fname="
+document.forms['fname'],
"mywindow",
"location=1,status=1,scrollbars=1,width=100,height =100";
}
else
{
urlStr = "http://192.168.14.13/test.html?fname=1",
"mywindow",
"location=1,status=1,scrollbars=1,width=100,height =100";
}
testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

I suspect that what you really want is something like:

function poponload() {
window.open("http://192.168.14.13/test.html?fname=fname",
"mywindow",
"location,status,scrollbars,width=100,height=1 00"
+"screenX=0,screenY=0,resizable");
}
--

Apr 9 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
2
by: Morgan | last post by:
Thanks to all of you because I solved the problem related with my previous post. I simply made confusion with pointers to pointers and then succeeded passing the reference to the first element...
2
by: craigkenisston | last post by:
Hi, I created an array of objects like this : object Values = {myObject.myprop, otherobject.otherprop, thirdobject.xprop}; Then I pass it to a method. and I get the values filled in that...
1
by: olduncleamos | last post by:
Hello all. With a background in ASP, I am finding the work required for passing values between pages mystifying. For various obvious reasons, I have eliminated using cookies and session to store...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
2
by: o1j2m3 | last post by:
I created 2 forms, A and B using VB.NET 2003 in A, the codes are : ========================== public AsName as string public AsPrice as double public sub setValue(ByVal sname as string,...
1
by: vncntj | last post by:
I have a C#.NET that simply passes 6 values to a Stored Procedure. But I'm trying to get the (Default.aspx.cs page) to handle passing the values to the sp. The goal is to pass the values and see...
3
by: ishwarbg | last post by:
Hi Everyone, I have a .Net Application, through which I am invoking a function from a legacy DLL developed in C++. My structure in C# contains some data of type double which I need to pass to to...
2
by: csmith8933 | last post by:
How do I write a function where the number of parameters it takes varies? This is what I have but it doesnt work. // function prototype void functionThree(int num1=1, int num2=2, int num3=3);...
5
by: jmartmem | last post by:
Greetings, I have built an Update Record Form in an ASP page. This form contains a number of fields, such as text boxes and menus, to name a few. Upon clicking the 'submit' button, I want the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.