/    Sign up×
Community /Pin to ProfileBookmark

Data text input help

Hi. I’m fairly new to javascript and am trying to create a script to maintain a member directory. The script must be able to add members and delete members. First, I’m trying to create the addmem() function and am having trouble. I can’t figure out how to pull information from the input from the form. It’s as if nothing was entered. I’m sure it’s something simple (as I’m new to this) and would appreciate any help. Here’s my html code

[code=html]<form action=”sample.html” method=”get”>
<table border=”1″ id=”tabledir”>
<tr>
<td colspan=”5″ id=”center”><p id=”pdata”>Member Directory</p></td>

</tr>

<tr>
<td>&nbsp;</td>
<td><p id=”pdata”>First Name</p></td>
<td><p id=”pdata”>Last Name</p></td>
<td><p id=”pdata”>Address</p></td>
<td><p id=”pdata”>Number</p></td>
</tr>
<tr>
<td><input type=”button” value=”Add Member” onclick=”addmem()”></td>
<td><input type=”text” name=”txtRow1″></td>
<td><input type=”text” name=”txtRow2″></td>
<td><input type=”text” name=”txtRow3″></td>
<td><input type=”text” name=”txtRow4″></td>
</tr>

<tr style=”font-size: 10px”>
<td style=”border: 0″>&nbsp;</td>
<td width=”160px” style=”border: 0″>&nbsp;</td><td width=”160px” style=”border: 0″>&nbsp;</td>
<td width=”160px” style=”border: 0″>&nbsp;</td><td width=”160px” style=”border: 0″>&nbsp;</td>
</tr>

<tr>
<td id=”center”><input type=”button” value=”x” onclick=”add()”></td>
<td><p id=”pdata”>Joe</p></td>
<td><p id=”pdata”>Smith</p></td>
<td><p id=”pdata”>1234 Street</p></td>
<td><p id=”pdata”>(123) 456-7890</p></td>
</tr>
</table>
</form>[/code]

the javascript can be found here
[URL=”http://techjoshonline.com/jim/database.js”]http://techjoshonline.com/jim/database.js[/URL]

Thanks in advance for any help

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 07.2009 — id must be unique!

var firstName=document.form[0].txtRow1.value;
×

Success!

Help @techjosh 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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