473,508 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple Javascript form problem

7 New Member
What is wrong with this code that getval is not found?

// This function opens the login window.

Expand|Select|Wrap|Line Numbers
  1. var loginWin;
  2.  
  3. function getval ()
  4. {
  5. return true;
  6. document.write ("here I am");
  7. alert ("boo");
  8. }
  9.  
  10.  
  11. function login ()
  12. {
  13.  
  14. loginWin = window.open ("", "EditLogin", "width=20,height=600,scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no");
  15.  
  16. loginWin.resizeTo(300,200)
  17.  
  18. loginWin.document.write("here");
  19. loginWin.document.write('<form name="logform" action="" onSubmit="getval()">');
  20. loginWin.document.write('<label>Username</label><br/><input name="username"/><br/>');
  21. loginWin.document.write('<label>Password</label><br/><input name="password" type="password"/><br/>');
  22. loginWin.document.write('<input type="submit" name="login" value="login">');
  23. loginWin.document.write('</form>');
  24.  
  25. }
Thanks
Feb 15 '08 #1
3 1203
acoder
16,027 Recognized Expert Moderator MVP
Moved to the JavaScript forum. Please post your question in the appropriate forum.

getval can't be found because it's in the parent page and the code calling it is in the child window. Use window.opener.getval() to refer to it correctly.
Feb 15 '08 #2
igraffman
7 New Member
You were right, of course! It works.

Thanks so much!


Moved to the JavaScript forum. Please post your question in the appropriate forum.

getval can't be found because it's in the parent page and the code calling it is in the child window. Use window.opener.getval() to refer to it correctly.
Feb 23 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
You're welcome. Glad you got it working.
Feb 25 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2649
by: mark leeds | last post by:
i am not a javasript programmer by any stretch but i have been writing a javascript programmer for a friend that does the following : 1) prompts the user for first name, middle name and last...
7
1753
by: J. Hall | last post by:
Hi dudes, Got a simple webpage, with three numeric text input boxes, the idea being that the user is asked to insert percentages of their business around the world... UK, Europe, Other ...
13
2330
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
6
2123
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I don´t know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
2
1441
by: not | last post by:
Hello All, I am trying to develop a relatively simple self-quiz form in javascript, but I'm having no luck getting it to work. What I am looking for is a script that allow the user to select...
5
3074
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
0
1871
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
27
4583
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
7
1754
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
24
6286
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
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,...
1
7046
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
7498
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...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.