SunQuest
 
           JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old May 2nd, 2006, 03:40 AM
jang jang is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 1 jang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 39 sec
Reputation Power: 0
Error saying null or not an object.

Im getting an error saying document.forms.classic.option is a null or not an object... actually my code every time a user enters an add row button it will add a row and then on selecting a combobox in a row another combo box will populate and then selecting that another combobox will populate ,all of dem in d same row , but when i add the second row and choose any thing in the first combo box i get dis error... kindly help...


<body>
<form name="classic">
<TABLE ID="tblPets" border="1" STYLE="border width:1 orange dashed;background color:#F0E68C;table-row width:2;">

<TR>
<TH>S.No</TH>
<TH WIDTH="70">ABC</TH>
<TH WIDTH="230">type</TH>
<TH WIDTH="70">var</TH>
<TH WIDTH="70">calc</TH>
<TD ALIGN="center"><INPUT TYPE="Button" onClick="addRow('tblPets')" VALUE="Add Row"></TD>
</TR>
<TR>
<TD>1</TD>
<TD>xyz</TD>
<TD>2-3-2</TD>
<TD>2</TD>
<TD>2</TD>
<TD><INPUT TYPE="Button" CLASS="Button" onClick="delRow()" VALUE="Delete Row"></TD>
</TR>
<TR>
<TD>2</TD>
<TD>xyw</TD>
<TD>3-2-3</TD>
<TD>4</TD>
<TD>3</TD>
<TD><INPUT TYPE="Button" CLASS="Button" onClick="delRow()" VALUE="Delete Row"></TD>
</TR>
</TABLE>
<SCRIPT TYPE="text/javascript">
var gUniqueRowID = 0;

var count = "1";

function addRow(in_tbl_name)
{
gUniqueRowID += 1;
var tbody = document.getElementById(in_tbl_name).getElementsBy TagName("TBODY")[0];
// create row
var row = document.createElement("TR");
// create table cell 1
var td1 = document.createElement("TD")

var strHtml1 = "<FONT SIZE=\"3\">#ROWID#</FONT>";
td1.innerHTML = strHtml1.replace(/#ROWID#/g,""+gUniqueRowID);
// create table cell 2
var td2 = document.createElement("TD")
var strHtml2 = "<INPUT TYPE=\"text\" NAME=\"in_name\" SIZE=\"30\" MAXLENGTH=\"30\" STYLE=\"height:24;border: 1 solid;margin:0;\">";
td2.innerHTML = strHtml2.replace(/!count!/g,count);
// create table cell 3
var td3 = document.createElement("TD")
var strHtml3 = "<SELECT NAME=\"Animal\"onChange=\"updateSize()\"><OPTION VALUE=\"2\">2-3-3<OPTION VALUE=\"3\">3-2-4<OPTION VALUE=\"4\">4-3-4</SELECT>";

td3.innerHTML = strHtml3.replace(/!count!/g,count);
// create table cell 4
var td4 = document.createElement("TD")
var strHtml4 = "<select name=\"size\"onChange=\"updateSize1()\"></select>";
td4.innerHTML = strHtml4.replace(/!count!/g,count);
// create table cell 5
var td5 = document.createElement("TD")
var strHtml5 = "<select name=\"size1\"></select>";
td5.innerHTML = strHtml5.replace(/!count!/g,count);
// create table cell 6
var td6 = document.createElement("TD")
var strHtml6 = "<INPUT TYPE=\"Button\" CLASS=\"Button\" onClick=\"delRow()\" VALUE=\"Delete Row\">";
td6.innerHTML = strHtml6.replace(/!count!/g,count);
var td7 = document.createElement("TD")
var strHtml7 = "<INPUT TYPE=\"Button\" CLASS=\"Button\" onClick=\"reload()\" VALUE=\"Ok\">";
td7.innerHTML = strHtml7.replace(/!count!/g,count);
// append data to row
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
row.appendChild(td4);
row.appendChild(td5);
row.appendChild(td6);
row.appendChild(td7);
// add to count variable
count = parseInt(count) + 1;
// append row to table
tbody.appendChild(row);



}
function reload()
{
window.location.reload()
}

function delRow()
{
var current = window.event.srcElement;
//here we will delete the line
while ( (current = current.parentElement) && current.tagName !="TR");
current.parentElement.removeChild(current);
}
function updateSize()
{
currSelect = document.forms["classic"].Animal.options[document.forms["classic"].Animal.selectedIndex].value
//create options based on selection
if (currSelect == "3"){
//paramaters are (display text,value,default selected,selected)
document.classic.size.options[0]=Option("2Pass","2Pass")
document.classic.size.options[1]=Option("3Pass","3Pass")
document.classic.size.options[2]=Option("4Pass","4Pass",true,true)
}else if (currSelect == "4"){
document.classic.size.options[0]=Option("3Pass","3Pass")
document.classic.size.options[1]=Option("4Pass","4Pass")
document.classic.size.options[2]=Option("5Pass","5Pass",true,true)
}
}
function updateSize1()
{
currSelect = document.classic.size.options[document.classic.size.selectedIndex].value
//create options based on selection
if (currSelect == "2Pass"){
//paramaters are (display text,value,default selected,selected)
document.classic.size1.options[0]=Option("2Post","2Post")
document.classic.size1.options[1]=Option("3Post","3Post")
document.classic.size1.options[2]=Option("4Post","4Post",true,true)
}else if (currSelect == "3Pass"){
document.classic.size1.options[0]=Option("3Post","3Post")
document.classic.size1.options[1]=Option("4Post","4Post")
document.classic.size1.options[2]=Option("5Post","5Post",true,true)
}
}


</SCRIPT>
</body>
</form>

Reply With Quote
  #2  
Old May 2nd, 2006, 11:35 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 3
Send a message via Yahoo to ravs
hey jang i tried ur code but can u tell me from where u r using that option becauswe the is nothing.
i will send u one of my code and you can check it out. i will send it later in the day

Reply With Quote
  #3  
Old June 13th, 2006, 01:46 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 9 m 44 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
Exclamation please contact me

hello,

i am thinking of a way that we could do this, if you want me to work on this subject. the way i understand what you want is that you want to beable to click to add a text-field and also click another button to delete it, if this is true we could use a <div> layer and a fuction consisting of a "for" loop controled by a counter, anyway, if you want me to work on it, email me at Colton22@comcast.net and i will, you have gotten me intrested in doing this so i probably will do this anyway

colton -- http://www.freewebs.com/colton22

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Error saying null or not an object.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway