?
Solved

Open the [age in window in javascript

Posted on 2011-10-14
2
Medium Priority
?
145 Views
Last Modified: 2012-05-18
Hi,
  How can I open the page in window when I do document.form.submit(); I have below code. when I do the submit using button, it is working fine, but when I hit enter..it is opening in a new webpage not in window.
I have the below code when hit enter

if (keycode == 13) {
             document.loginform.submit();
            return false;
}

please let  me know how can I open in a new window with the properties specified in onSubmit.

Thank you

<form name="loginform" method="post" action="loginbean.jsp" target="login"  onsubmit="window.open('', 'login', 'width=screen.availWidth-15,height=screen.availHeight-40,left=0,top=0,resizable=yes,scrollbars=yes')">

Open in new window

0
Comment
Question by:Sthokala
2 Comments
 
LVL 2

Accepted Solution

by:
cslimrun earned 1000 total points
ID: 36970660
try adding the id property to the form:
id="loginform"

you can use this syntax to submit the form from javascript:
document.getElementById("loginform").submit();

make sure you are capturing the enter key correctly - I've used JQuery hotkeys package with great success:
http://code.google.com/p/js-hotkeys/
0
 

Author Comment

by:Sthokala
ID: 36970879
Thank you for your reply. I still see the page with the tool bars. Please see the below 2 images. When I click enter, I see the tool bars, but when I click on the button, it doesn't show tool bars. Please let me know how can I solve this.

Thank you
enter.PNG
submit-button.PNG
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question