<nooby>Creating objects and adding test written into a input field to a text area
hi...
i need to create a team roster for a baseball team,and include fields for the name, surname,position played,contact number, and gardian permission ect. and i need to include functionality to alow the coach to add, delete,and update info,the gaurdian permission must be a check box.then i need to write some code to submit all this to a form processor html document. i have the forms rite
<table width="750" border="0" align="center">
<tr>
<td> <select name="contacts" size="13" style="width: 150px" onclick="contactList['contact' + this.selectedIndex].getContacts();">
<option value="contacts">Team Members</option>
</select> </td>
<td>Last Name <br />
<form><input type="text" name="lastname" size="50" /><br />
First name<br />
<input type="text" name="firstname" size="50" /><br />
Telephone<br />
<input type="text" name="positionplayed" size="50" /><br />
Position Played <br />
<input type="text" name="gaurdian" size="50" /><br />
Gaurdian's Permission<br /><input type="radio" name="gaurdian"/></form></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="button" value="Add Member" onclick = "addMember()" />
<input type="button" value="Delete Member" onclick="deleteMember()" />
<input type="button" value="Update Info" onclick="contactList['contact' + document.forms[0].contacts.selectedIndex].updateMember(document.forms[0].contacts.selectedIndex);" /> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
got no idea do do the Java scripting....im a newBy...
if anyone would be so kind to solve this prob for me.....i would apreciate much!!!!
I worked on this until I got tired of it. If you wish to continue, learn about Arrays and the methods of push() and splice()
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD> <TITLE> Su8-18pm23</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8" >
<STYLE type=text/CSS>
.txInp{margin-left:10px;font-weight:bold}
</STYLE>
<SCRIPT type="text/javascript" >
var roster=['Tom,Jones,123-456-7890,outfield,1','Jack,Handy,345-678-9012,1st base,1','Billy,Thomson,234-567-8799,catcher,0'];
for(i=0;i<roster.length;i++){ roster[i]=roster[i].split(',')}
</SCRIPT>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR> </HEAD>
<BODY >
<form style="width:750px;border:1px black solid" onsubmit="submits(); return false" >
<div id="reworks" style="width:155px;float:left" >
<select size="13" style="width:150px;" onclick="Contacts(this.selectedIndex);" > </select> </div>
<div> Last Name<br>
<input size="50" class="txInp" > <br>
First name<br>
<input size="50" class="txInp" > <br>
Telephone<br>
<input size="50" class="txInp" > <br>
Position Played<br>
<input size="50" class="txInp" > <br>
Gaurdian's Permission
<input type="checkbox" > <p>
<input type="button" value="Add Member" onclick = "Contacts('add')" />
<input type="button" value="Delete Member" onclick="Contacts('delete')" />
<input type="button" value="Update Info" onclick="Contacts('update')" />
<input type="submit" value="SAVE" />
</form>
<SCRIPT type="text/javascript" >
var inx;
function Contacts(z){ var f0=document.forms[0];
if(!z){
var f0d0=document.getElementById('reworks');f0d0.removeChild(f0d0.firstChild);
var t='<select size="13" style="width:150px;" onclick="Contacts(this.value);" > ';
for(i=0;i<roster.length;i++){t+='<option value="'+i+'" >'+roster[i][0]+' '+roster[i][1]+'</option>'}
t+='</select>';
f0d0.innerHTML=t; return}
else if(!isNaN(z)){inx=z;
for(i=0;i<roster[z].length-1;i++){f0.elements[i+1].value=roster[z][i]; }
roster[z][roster[z].length-1]=='1'?f0.elements[5].checked=true:f0.elements[5].checked=false;
}
else if(z=='update'){
for(i=0;i<roster[inx].length-1;i++){roster[inx][i]=f0.elements[i+1].value; }
f0.elements[5].checked==true?roster[inx][roster[inx].length-1]='1':roster[inx][roster[inx].length-1]='0';
Contacts()
}
else if(z=='add'){}
}
Contacts()
function submits(){alert('do form submit stuff here')}
</SCRIPT>
</BODY> </HTML>
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks