By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Cannot get my variable to display the value?

P: 4
I am taking a course of which Javascript is part. I don't necessairly want an answer but if someone could point me in the right direction I would appreciate it I have to create a 16x16 table that shows the first 256 character entities with the entity number and corresponding symbol for each. When the script outputs to the browser it does not show the number. It show 'k' for everything. Where should I look? Thanks.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. k=1;
  3. document.write("<table>");
  4. for (i = 1; i <= 16; i++) {
  5. document.write("<tr>");
  6.     for (j = 1; j <= 16; j++) {
  7. document.write("<td> <center>k <br /> &#k;</center> </td>");
  8. k++
  9. }
  10. document.write("</tr>");
  11. }
  12. document.write("</table>");
  13. </script>
Jan 28 '08 #1
Share this Question
Share on Google+
6 Replies


P: 4
I am taking a course of which Javascript is part. I don't necessairly want an answer but if someone could point me in the right direction I would appreciate it I have to create a 16x16 table that shows the first 256 character entities with the entity number and corresponding symbol for each. When the script outputs to the browser it does not show the number. It show 'k' for everything. Where should I look? Thanks.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. k=1;
  3. document.write("<table>");
  4. for (i = 1; i <= 16; i++) {
  5. document.write("<tr>");
  6. for (j = 1; j <= 16; j++) {
  7. document.write("<td> <center>k <br /> &#k;</center> </td>");
  8. k++
  9. }
  10. document.write("</tr>");
  11. }
  12. document.write("</table>");
  13. </script>
Jan 28 '08 #2

BigDaddyLH
Expert 100+
P: 1,216
Moved from Java to JavaScript forum. Java is not JavaScript. Good luck in your JavaScript course.

--MODERATOR
Jan 28 '08 #3

P: 4
Thanks, I realized that after I posted it.

Moved from Java to JavaScript forum. Java is not JavaScript. Good luck in your JavaScript course.

--MODERATOR
Jan 28 '08 #4

P: 27
I hope this will work for you .It seems to me that you were not concatenating the string correctly.


Expand|Select|Wrap|Line Numbers
  1.         <script type="text/javascript">
  2.                           k=1;
  3.                          document.write("<table>");
  4.                           for (i = 1; i <= 16; i++) {
  5.                                document.write("<tr>");
  6.                                        for (j = 1; j <= 16; j++) {
  7.                                             document.write("<td> <center>k <br /> "+k+";</center> </td>");
  8. k++
  9. }
  10.                              document.write("</tr>");
  11. }
  12.                        document.write("</table>");
  13.              </script>
Jan 28 '08 #5

gits
Expert Mod 5K+
P: 5,329
threads merged ...

kind regards
MODERATOR
Jan 28 '08 #6

P: 4
Thank you very much. I was able to take that and make the rest of it work. I was close but just couldn;t find that last piece.
Jan 28 '08 #7

Post your reply

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