•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,714 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,385 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1626 | Replies: 7
![]() |
wait:
[html]
<!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" xml:lang="en" lang="en">
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
var a=10;
document.write("<table border='1'>")
document.write("<tr><td>N</td><td>10*</td><td>100*</td><td>1000*</td></tr>")
for(i=1;i<=5;i++)
{
document.write("<tr><td>"+i+"</td><td>"+i*a+"</td><td>"+i*a*a+"</td><td>"+i*a*a*a+"</td></tr>");
}
document.write("</table>");
/*]]>*/
</script>
</head>
<body>
</body>
</html>
[/html]
[html]
<!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" xml:lang="en" lang="en">
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
var a=10;
document.write("<table border='1'>")
document.write("<tr><td>N</td><td>10*</td><td>100*</td><td>1000*</td></tr>")
for(i=1;i<=5;i++)
{
document.write("<tr><td>"+i+"</td><td>"+i*a+"</td><td>"+i*a*a+"</td><td>"+i*a*a*a+"</td></tr>");
}
document.write("</table>");
/*]]>*/
</script>
</head>
<body>
</body>
</html>
[/html]
Hi There,
Well code that wrote by vishesh doing the same thing that you want
Just he miss ";" two place, just add and code will run
And you can use the this code as well
[HTML]
<!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 language="JavaScript" type="text/javascript">
//<![CDATA[
document.write("<table width='600' border='1' cellspacing='3' cellpadding='3'>");
document.write("<tr>");
document.write("<th>N</th>");
document.write("<th>10*</th>");
document.write("<th>100*</th>");
document.write("<th>1000*</th>");
document.write("</tr>");
//This is Looping
var num = 1;
for (var x=1; x <= 5; x++)
{
document.write("<tr><td>" + num*1 + "</td><td>" + num*10 + "</td><td>" + num*100 + "</td><td>" + num * 1000 + "</td></tr>");
num = num + 1;
}
document.write("</table>");
//]]>
</script>
</head>
<body>
</body>
</html>
[/HTML]
sorry for editing this post again:
here the validation result
http://validator.w3.org/check?uri=ht...doctype=Inline
Best regards,
Rahul Dev
Well code that wrote by vishesh doing the same thing that you want

Just he miss ";" two place, just add and code will run
And you can use the this code as well
[HTML]
<!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 language="JavaScript" type="text/javascript">
//<![CDATA[
document.write("<table width='600' border='1' cellspacing='3' cellpadding='3'>");
document.write("<tr>");
document.write("<th>N</th>");
document.write("<th>10*</th>");
document.write("<th>100*</th>");
document.write("<th>1000*</th>");
document.write("</tr>");
//This is Looping
var num = 1;
for (var x=1; x <= 5; x++)
{
document.write("<tr><td>" + num*1 + "</td><td>" + num*10 + "</td><td>" + num*100 + "</td><td>" + num * 1000 + "</td></tr>");
num = num + 1;
}
document.write("</table>");
//]]>
</script>
</head>
<body>
</body>
</html>
[/HTML]
sorry for editing this post again:
here the validation result
http://validator.w3.org/check?uri=ht...doctype=Inline
Best regards,
Rahul Dev
Last edited by katarey : Nov 26th, 2006 at 3:51 pm. Reason: Adding some code
Freelance Web Designer & Developer
Http//www.Katarey.com
Http//www.Katarey.com
OMG! thank your very much. Just one question how did you use looping. I mean in which lines? thx again 
this is for loop. the for loop first initialises variable i to 1
this line just write the table row and cells.

for(i=1;i<=5;i++)
{
document.write("<tr><td>"+i+"</td><td>"+i*a+"</td><td>"+i*a*a+"</td><td>"+i*a*a*a+"</td></tr>");
}i=1 and everytime increments it by 1i++ until i becomes greater than or equal to 5. And every time i increments it executes document.write("<tr><td>"+i+"</td><td>"+i*a+"</td><td>"+i*a*a+"</td><td>"+i*a*a*a+"</td></tr>"); Last edited by vishesh : Nov 26th, 2006 at 5:05 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Learning web design, HTML, CSS, etc... (HTML and CSS)
- Looking for freelance job (web-developer) (Web Development Job Offers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Random CSS Stylesheet selector exists?
- Next Thread: this. method is working "backwards"



Linear Mode