473,404 Members | 2,213 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,404 software developers and data experts.

Javascript prompt then open new window

3
This project is a web based html and Javascript site. I am working on mac at the moment. This script works except for attempting to open new window once complete.

As you can see, i am new to javascript coding. Can i open a new browser window after my prompts and alerts have finished. I am not sure what i am doing wrong.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>

<script type="text/javascript">
<!--
function displayMessage() {
alert("Hello " + ", thanks for being patient just a few more question before we procced!")

var ans = prompt("Do you have some time to answer some questions?");
if (ans == "no") {
return;// stop the script
}
else {
alert ("about to open window");
window.open("form2.html","test","toolbar=no,menuba r=no,width=200,height=200,resizable=yes"); // I want to a open new window after prompts are finished.

alert ("Your answers will be placed in the appropriate areas, please check form once complete");

alert ( "thank you, we shall proceed");
prompt("Your first name");
prompt("Your last name ");
prompt("Your street address");
prompt("Your apt number");
prompt("Your city");
}

}

</script>
</head>

<body onLoad ="javascript:displayMessage();">
i change this line every time i reopen the page to make sure i am opening the right page.

</body>
</html>
May 8 '07 #1
5 3883
acoder
16,027 Expert Mod 8TB
First of all, this is not a good way to get input. Just let the user input the data themselves instead of using prompts.

If you want to open the window after the prompts, you will have to move the window.open after the prompts.

You will also want to save the inputs from the prompts, e.g.
Expand|Select|Wrap|Line Numbers
  1. var name = prompt("...
May 8 '07 #2
hcross
3
this page is not supposed to collect the user information. My project is built to annoy the user, see how long a person keep on trying to enter information into a form that doesn't work.

Thanks for the help, though.
May 8 '07 #3
hcross
3
do you know how to redirect a form after validation has been completed. TO say thanks for taking the time to participate in our experiment.
May 8 '07 #4
acoder
16,027 Expert Mod 8TB
this page is not supposed to collect the user information. My project is built to annoy the user, see how long a person keep on trying to enter information into a form that doesn't work.

Thanks for the help, though.
Hmm..an experiment. That would definitely be annoying.
May 9 '07 #5
acoder
16,027 Expert Mod 8TB
do you know how to redirect a form after validation has been completed. TO say thanks for taking the time to participate in our experiment.
By redirecting, do you mean to a new page? You can redirect using:
Expand|Select|Wrap|Line Numbers
  1. location.href=newurl
May 9 '07 #6

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

Similar topics

1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
4
by: vagos | last post by:
Hi, When opening a page, i want to open a new javascript window and close the first. like: <script language=javascript> function openw(){...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
1
by: Nevyn Twyll | last post by:
I have a DataList; in the DataList's , I have a LinkButton and a few listboxes. When the LinkButton is pressed, I need to get the ID of the selected item in one of the Listbox controls. Then I...
2
by: Chris | last post by:
I know this is a dead horse I'm beating but why is it so impossible to ask for functionality in the HTML tag to open a window/page more controllable? why is: <a href="somepage.aspx?value1=xyz"...
3
by: J.P. Cummins | last post by:
In my ASP.NET application, I wish to have a page for administrators to edit items in a list. Preferably, I would like to use the javascript prompt for the 'rename' function, and a javascript alert...
4
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park...
1
by: peerraghu | last post by:
hi i am creating travels project using .net and c# and iam new to java scripts i want to open new window with in the same page after clicking the image i have wreiten code just look at this ...
1
mageswar005
by: mageswar005 | last post by:
Hello, In My Application i have open the PDF file from javascript open.window function.In This scenario i want to control / Hide the PDF Toolbar from open.window function. My Current code is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.