| | |
javaScript/XHTML.
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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 4:51 pm. Reason: Adding some code
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 JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
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 6:05 pm.
![]() |
Similar Threads
- 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"
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array browser bug captchaformproblem cart checkbox child class close codes createrange() css cursor date debugger decimal dependent design disablefirebug dom dropdown editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming progressbar prototype redirect runtime safari scale scriptlets scroll search security shopping size software toggle unicode w3c web wysiwyg \n






