/    Sign up×
Community /Pin to ProfileBookmark

exit prompt window?

When the user hits the cancel button in the veryfirst prompt window I would like the JS program to close and for there to be just the internet browser open. How would I go about doing this. I have tried several things but none seem to work.
Thanks for any help.

Here is the code:

<!–

var comstock = window.prompt(“How Many Company Stock Owned? Enter#1-10″,””);
while(comstock<1||comstock>10){comstock=window.prompt(“invalid number re-enter”,””);}

var sellArray = new Array(comstock);
var costArray = new Array(comstock);
var symbolArray = new Array(comstock);

var sellingPrice;
var cost;
var symbol;

var i = 0;
while (i < comstock)

{

symbol = window.prompt(“Symbol for Company Stock?”,””);
cost = window.prompt(“Cost of Company Stock?”,””);
sellingPrice = window.prompt(“Selling Price of Company Stock?”,””);

symbolArray[i] = symbol;
costArray[i] = cost;
sellArray[i] = sellingPrice;
i++;

}

for(x = 0; x < comstock;x++){
var answ = costArray[x] – sellArray[x];

if(answ < 0)
document.write(“<font color=’red’>”);
if(answ >= 0)
document.write(“<font color=’blue’>”);

document.write(symbolArray[x] + “: ” + answ + “<br>”);

}
//–>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@russellDec 07.2004 — <i>
</i>var comstock = prompt("How Many Company Stock Owned? Enter#1-10","");

if(comstock) {
while(comstock&lt;1||comstock&gt;10){comstock=window.prompt("invalid number re-enter","");}

var sellArray = new Array(comstock);
var costArray = new Array(comstock);
var symbolArray = new Array(comstock);

var sellingPrice;
var cost;
var symbol;

var i = 0;
while (i &lt; comstock)

{
symbol = window.prompt("Symbol for Company Stock?","");
cost = window.prompt("Cost of Company Stock?","");
sellingPrice = window.prompt("Selling Price of Company Stock?","");

symbolArray[i] = symbol;
costArray[i] = cost;
sellArray[i] = sellingPrice;
i++;
}

for(x = 0; x &lt; comstock;x++){
var answ = costArray[x] - sellArray[x];

if(answ &lt; 0)
document.write("&lt;font color='red'&gt;");
if(answ &gt;= 0)
document.write("&lt;font color='blue'&gt;");

document.write(symbolArray[x] + ": " + answ + "&lt;br&gt;");
}

×

Success!

Help @eco spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...