Hi, I'm new in this forum. I would like to please you help in some basic javascript exercises in which I don't know how to do.
1.The first exercise requires me : Use a loop to create a table with 3 columns. The first column should have the numbers from 10 to 20. The second column should have the number times 3. The third column should have the number divided by 3.
2. Using statements IF: Assume the variable "mclass" contains the class of a movie.
Purpose: determine how long you can keep the movie. Put this information in the variable "rentl"
If the class of the movie is "c " you can keep the movie for 2 weeks otherwise only 1 week.
function num10to20 (){
for (var number=10; number<=20; number++)
}
function numtimes3(){
for (var number=10; number<=20; number+*3)
}
function numdiv3(){
for (var number=10; number<=20; number+/3)
}
</script>
I am thinking you might be misunderstanding what the expected table from exercise #1 would be. When I read the description it sounded to me like your output might look something like:
If I understand the first question right, you are required to create a table within a loop by dynamically manipulating the DOM (document object model). To do this you need to use the createElement() function.
It's actually a little trickier than you would think and probably not something you'd figure out as a beginner. If you follow strict standards, you'll also need to create table head and table body elements. I've created a comprehensive solution which you can play with: http://jsfiddle.net/DUMnb/2//
Bookmarks