prompting

This is a discussion on "prompting" within the JavaScript Forum section. This forum, and the thread "prompting are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 6th, 2005, 06:25
New Member
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
prompting

i've created an error message to enter only values but the program stops. How do i continue to re prompt the user to enter a value without ending the program?
Reply With Quote

  #2 (permalink)  
Old Nov 6th, 2005, 15:02
Banned Member
Join Date: Sep 2005
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prompting

1. sho us yer kode or the url
Reply With Quote
  #3 (permalink)  
Old Nov 6th, 2005, 21:42
New Member
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prompting

PHP: Select all

document.write('<div align="center"><table border="1" cellpadding="5">');
var 
NumOfRows prompt("Please enter number of rows""Enter your number here");
var 
NumOfColumns prompt("Please enter number of columns""Enter your number here");
 
while (
NumOfColumns <= null || NumOfColumns >= 0){
window.alert("Enter a valid number for column.")
NumOfColumns prompt("Please enter number of columns""Enter your number here");
}
 
while (
NumOfRows <= null || NumOfRows >=0){
window.alert("Enter a valid number for row.")
NumOfRows prompt("Please enter number of rows""Enter your number here");
}
 
for (
Rows 1Rows<=NumOfRowsRows++) // Iterate through each cells of a row.
{
document.write('<tr align="center">');
 
if (
Rows == 9){ // Alerts message if value exeeds.
alert("Value of rows must not exeed maximum of 8. Please try again.");
break;
}
 
for(
Cols 1Cols<=NumOfColumnsCols++) // Iterate through the columns.
{
document.write('<td bgcolor="#000000"><font color="#FFFF33">' "R" Rows "C" Cols "</font></td>"
 
 
if (
Cols == 10){
alert("Value of columns must not exeed maximum of 10. Please try again.");
break;
}
}
 
document.write("</tr>")
}
 
 
document.write('</table></div>'); 

Last edited by Rob; Nov 7th, 2005 at 15:28.
Reply With Quote
  #4 (permalink)  
Old Nov 7th, 2005, 14:21
Banned Member
Join Date: Sep 2005
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prompting

PHP: Select all

<html>
<
head>
<
pre>
<
script language="JavaScript">
<!-- ***************** 
javaskript **************
var 
maxroe=8;
var 
maxcol=10;
//**** default input
numroes=3;
numcols=4
//*
document.write('<div align="center">');
document.write('<table border="1" cellpadding="5">');
//******* get from yuzer...# roes
string1=window.prompt("enter # roes, max=8""5");
if(
string1 ==""){string1="0"}
numroes=parseInt(string1);
if(
numroes 1){
stringx="**** error yer input # roes=0";
alert(stringx);
numroes=3;
}
if(
numroes maxroe){
stringx="warning...max # roes="+maxroe+", will set #="+maxroe;
alert(stringx);
numroes=8}
//******* get from yuzer...# columns
string2=window.prompt("number columns, max=10""3");
if(
string2 ==""){string2="0"}
numcols=parseInt(string2);
if(
numcols 1){
stringx="**** error yer input # cols=0";
alert(stringx);
numcols=4;
}
//*
//********** loop1...over roes
for(nowroe=1nowroe<=numroesnowroe=nowroe+1){
//* stringx="nowroe="+nowroe+", max="+numroes;
//* alert(stringx);
document.write('<tr align="center">');
//*
//********** loop2...over columns
for(nowcol=1nowcol<=numcolsnowcol=nowcol+1){
document.write('<td bgcolor="#000000">');
werkstr="<font color='#ffff33'>";
werkstr=werkstr+" R"+nowroe+" C"+nowcol+"</font>";
document.write(werkstr);
document.write("</td>");
}
//****** bottom av inner loop
document.write("</tr>")
}
//****** bottom av outer loop
document.write('</table></div>');
// -->
</script>
</head>
</html

Last edited by Rob; Nov 7th, 2005 at 15:27.
Reply With Quote
  #5 (permalink)  
Old Nov 9th, 2005, 02:17
New Member
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prompting

Thx muneepenee. This really helps.

Verynew.
Reply With Quote
Reply

Tags
prompting

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 19:24.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43