/    Sign up×
Community /Pin to ProfileBookmark

Dynamically Creating New Rows

Hi guys not sure if this should be classed as a DHTML question or Javascript or even ASP but I need some help.

I have a page that uses this javascript code to dynamically add rows to a table when a tick box is checked. It will then disable the tick box so that it cannot be cliked again:

<script type=”text/javascript”>
function insRow()
{
RowValue=document.forms.myform.valuebox.value
RowValue=(RowValue*1)+1

var x=myTable.insertRow()
var a=x.insertCell(0)
var b=x.insertCell(1)
var c=x.insertCell(2)
a.innerHTML=”<p align=’center’>” + WarehouseMaster.innerhtml + “</p>”
b.innerHTML=”<p align=’center’><input type=’text’ name=’Req” + RowValue + “‘ size=’5’></p>”
c.innerHTML=”<p align=’center’><input type=’checkbox’ name=’checkbox” + RowValue + “‘ value=’ON’ onclick=’insRow()’></p>”
NewRowCount.innerHTML=”<input type=’text’ name=’valuebox’ size=’5′ value='” + RowValue + “‘>”

var t=document.forms.myform
DisValue=RowValue*3
t[DisValue].disabled=true
}
</script>

The problem I’m having is that this row:

a.innerHTML=”<p align=’center’>” + WarehouseMaster.innerhtml + “</p>”

Should copy a select drop down box, along with it’s contents that is defined using SQL, into the new row. But for some reason all i get is the word “undefined”. Can anyone help me with this?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@david2105authorApr 11.2003 — Excellent that seems to have done the trick. It's amazing what someone else can see looking at your code.

Thanks for your help Dave.
×

Success!

Help @david2105 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...