This is a discussion on "Repeating table with js?" within the JavaScript Forum section. This forum, and the thread "Repeating table with js? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Repeating table with js?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Repeating table with js?
Having some issues outputting this. Basically how it works is a user enters a number and when the button is clicked it repeats the html code based on the input integer. So since it is not displaying correctly etc I am obviously doing something wrong. javascript is not my strong point so any help would be appreciated. It also randomly generates numbers in the card based on a xml file's contents which works fine. The problem is I lose the formatting and only the first table is displayed although incorrectly.
Code:
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
|
|
#2
|
|||
|
|||
|
Re: Repeating table with js?
As your terminating value is known at the start of the loop, you should be using the for statement. for (i=0; i <= burger; i++){ } You code for printing the table definitions is missing the <tr> element. You are going <table><td>... instead of <table><tr><td>... |
|
#3
|
|||
|
|||
|
Re: Repeating table with js?
Woops heh yup you are right, I will try this tomorrow. Thanks!
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#4
|
|||
|
|||
|
Re: Repeating table with js?
Ok so I got this:
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Last edited by moojoo; Jul 25th, 2006 at 12:47. |
|
#5
|
|||
|
|||
|
Re: Repeating table with js?
Quote:
Also you are saying the language is JScript and not JavaScript although it probable won't any difference with your code. JScript is IE specific. If you could do a mock-up of what you are expecting to happen, I might get a better idea. I don't think JavaScript requires you to escape the forward slashes, e.g., <\/tr> not required, </tr> will do. |
|
#6
|
|||
|
|||
|
Re: Repeating table with js?
Yeah it only needs to work in IE, and you are probably right about the escaping of the tags. That script file is what generates the table. It makes a 5 x 5 table and randomly generates numbers from 1 - 75 in each cell. It needs to repeat as many tables as specified by the user so they can be printed and given out.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#7
|
|||
|
|||
|
Re: Repeating table with js?
So if you remove the backslashes and run the program, what is the current situation? Are you saying the for loop only applies one iteration? If so I would look at the value being picked up for the number of repeats. |
|
#8
|
|||
|
|||
|
Re: Repeating table with js?
Well here it is currently.
1. The table is not getting displayed correctly and only repeats once 2. If I take off the escape on the js file call it breaks 3. If I remove the .js file call it repeats the BINGO table as many times as specified but not the 5x5 numbers grid 4. If I display the exact same code in the HTML document it displays normally but only once I had it write out the value of genvalue which is the text field and it displayed it correctly.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#9
|
|||
|
|||
|
Re: Repeating table with js?
Copied your str+=... line into a blank html page, previewed the page and got a black border around the word BINGO, so the code without the '\' is correct and does work. Are we maybe looking in the wrong area? Could it be something within the MeetingBingo.js file? I note also that your bingo+=... line still has a '\' in it. |
|
#10
|
|||
|
|||
|
Re: Repeating table with js?
Without escaping the bingo+ line it just cuts the script and outputs the js to the page. The linked .js file is what generates the table. If placed in the HTML it all works fine but only repeats once of course. The repeating bingo box should have 5 cells all with borders which is also not getting output correctly. Maybe this just won't work. I may convince them to let me use PHP or do it in asp.net.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#11
|
|||
|
|||
|
Re: Repeating table with js?
Attached is a shot of how it looks placed in the HTML.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#12
|
|||
|
|||
|
Re: Repeating table with js?
k, almost got it working. I stripped the js code I needed from the external js file and it now repeats as expected. Just a few things to patch up and its good to go. Thanks for all of your help.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
![]() |
| Tags |
| repeating, table |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HTML repeating problems?? | tails007 | Web Page Design | 8 | Jan 18th, 2008 13:12 |
| repeating background issues. | Therealmatt | Starting Out | 4 | Sep 20th, 2007 22:54 |
| CSS repeating bg for button | jwalker80 | Web Page Design | 3 | Mar 1st, 2007 21:11 |
| Repeating DIV in Safari | chevy409 | Web Page Design | 0 | Oct 4th, 2005 21:03 |