Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Javascript only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
Javascript
Display table repeatedly on Combo box selection
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
aswincts
New Member
Join Date:
Feb 2007
Posts:
3
#1
Display table repeatedly on Combo box selection
Feb 19 '07, 07:05 AM
I want to display repeat a <table> based on the count given in combo box
Please help me
acoder
Recognized Expert
MVP
Join Date:
Nov 2006
Posts:
16032
#2
Feb 19 '07, 10:36 AM
Changed thread title.
Comment
Post
Cancel
acoder
Recognized Expert
MVP
Join Date:
Nov 2006
Posts:
16032
#3
Feb 19 '07, 10:39 AM
Originally posted by
aswincts
I want to display repeat a <table> based on the count given in combo box
Please help me
To display a table, you can do that in two ways, either use the standard DOM methods or just use innerHTML. For the DOM method, see
here
.
For combo boxes, do you want it on selection, or activated by a button click?
Comment
Post
Cancel
dorinbogdan
Recognized Expert
Contributor
Join Date:
Feb 2007
Posts:
839
#4
Feb 19 '07, 11:24 AM
Just a small sample :
[HTML]
<html>
<head>
<title>Copy table</title>
</head>
<script language="JavaS cript">
function CopyTable(){
var tbl = document.getEle mentById("tbl") ;
var sel = document.getEle mentById("sel") ;
var max = sel.options[sel.selectedInd ex].value;
for (var i=1;i<=max;i++) {
var tbl2 = tbl.cloneNode(t rue);
tbl2.id = "tbl"+i;
document.body.a ppendChild(tbl2 );
}
}
</script>
<body>
<select id="sel">
<option value="1">one copy</option>
<option value="2">two copies</option>
<option value="3">three copies</option>
</select>
<input type="button" onclick="CopyTa ble()" value="Copy table">
<table border="1" id="tbl"><tr><t d>Table1</td></tr></table>
</body>
</html>
[/HTML]
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment