20 2917
What line is this error occurring on?
What line is this error occurring on?
it is in the javascript code line 32 where i am trying to make an object for the parentdiv and then remove the child node of that div. - var d = document.getElementById('txtHint'+0);
-
thanks for any help in advance,
regards
omer
Why "txtHint"+0? Why not "txtHint0"?
Why "txtHint"+0? Why not "txtHint0"?
nops sir it is still with that abnormal behaviour it wont make any difference like that :(
gits 5,390
Expert Mod 4TB
have you tried to alert the result from line 32 ... may be the error would more likely be with line 34 where you try the next getElementById() with a dynamic divname ...
so please - just have a look whether it is really line 32 ...
knd regards
have you tried to alert the result from line 32 ... may be the error would more likely be with line 34 where you try the next getElementById() with a dynamic divname ...
so please - just have a look whether it is really line 32 ...
knd regards
yes sir i have checked it and it do alerts the object of that olddiv on the line 34 but on alerting "variable d" it says that it is undefined so i think the error is on the line 32 where it is creating the object of the div "txtHint0" which is hard coded means the main div in which i am populating all the divs .... :(, and thats no way the browser is behaving, lemme explain the scenario once again if i missed some thing back. i have made a div in the main page "add-product-details.php" -
<div id="txtHint0" ></div>
-
now i have a button on this same page "Add Column" which onclick calls a AJAX funtion which gets the html response from another page "addcol.php"
and puts it into that <div id='txtHint0'></div> throoguh which another same column is populated next to the first column and the button of the "Add column" disappears from the first column and appears on the new column to populate another column if needed and so on , every thing is going fine till the adding process at both ends Mozilla and IE but when it comes to deleting it gives me the same sick error,
i hope so i have quit elaborated the problem , would be no more confusion regarding to the scenario,
hope to get a positive reply,
regards,
omer
When you're ready to delete (and the error occurs when you press delete), check the contents of the txtHint0 div by using e.g. Firebug. What are the contents at that point?
gits 5,390
Expert Mod 4TB
hmmm ... i just actually see the following strange thing from one more quick look:
you create an id while adding: - var divIdName = 'txthint' + num;
-
resdiv.setAttribute( 'id', divIdName );
-
and later on you try to use 'txtHint' ... but the id should be case sensitive and so may be the problem?
kind regards
hmmm ... i just actually see the following strange thing from one more quick look:
you create an id while adding: - var divIdName = 'txthint' + num;
-
resdiv.setAttribute( 'id', divIdName );
-
and later on you try to use 'txtHint' ... but the id should be case sensitive and so may be the problem?
kind regards
good to see you here gits :) well these two lines that you coded are used to assign the id to a new div that is created IN the "txtHint0" that is the main div or the parent div you can and the error is not on the line 32 where i try to use the var d for holding the object for the main div i.e txtHint0 it says that it is undefined
gits 5,390
Expert Mod 4TB
i know ... but in line 33 you create a divname: - var divname ='txtHint'+divno;
-
and isn't that a div IN the parent? that you try to refer to? to remove it then from the parent?
kind regards
i know ... but in line 33 you create a divname: - var divname ='txtHint'+divno;
-
and isn't that a div IN the parent? that you try to refer to? to remove it then from the parent?
kind regards
yes the new created div is in the parent div,i have a hidden input field on the main page with the name count this field is incremented as the "AddColumn" button is pressed and that value is then passed through the ajax function to the addcol.php file where this value is concatinated with the div elements specially with the
"Add Column" and the "Delete Column" buttons ids and then passed through the onclik function of the Delete button , every new div created has the prefix "txtHint"+ a suffix that has a dynamic or you can say incrementing value which regards to the last div created means if initially you click on the add column button it increments the value in he count input field then the new div created has the name "txtHint1"in which 1 is comming from the value of the counter and so on, now if i have to delete that column the same value 1 is passed through he function into that RemoveDiv(); function, the line which you mentioned tehre i was trying to get the value directly from the count field because i thaught that may be the value is not the right one you can change that line to
and yes one thing i just misguided you that it gives me error on the last line where i am trying to remove the child node where as i have alerted all the values and now all the values are being alerted means d,divno,divname and even the old div all when alerted no one is giving me error or blank value but as soon it comes to the last line it says that node not found
regards,
omer
gits 5,390
Expert Mod 4TB
so the alerts you did are what you expected? ... then please post what the following alert says when you want to remove a node: - function removediv(){
-
var divno = document.getElementById('count').value;
-
var d = document.getElementById('txtHint'+0);
-
-
alert(d.innerHTML);
-
-
var divname ='txtHint'+divno;
-
var olddiv =document.getElementById(divname);
-
d.removeChild(olddiv);
-
}
so the alerts you did are what you expected? ... then please post what the following alert says when you want to remove a node: - function removediv(){
-
var divno = document.getElementById('count').value;
-
var d = document.getElementById('txtHint'+0);
-
-
alert(d.innerHTML);
-
-
var divname ='txtHint'+divno;
-
var olddiv =document.getElementById(divname);
-
d.removeChild(olddiv);
-
}
according to the above given code the alert gives me the html code for the last created div here is the code -
<div id="txthint1"><td class="tdTitle" align="left" width="600">
-
<table align="left" border="0" cellpadding="5" cellspacing="1" width="300">
-
<tbody><tr>
-
<td class="tdTitle" colspan="2" align="left">
-
<table align="left" border="0" cellpadding="0" cellspacing="0">
-
<tbody><tr>
-
<td align="left" valign="middle">Version<br><input name="versionname[]" id="versionname[]" class="input" type="text"> </td>
-
<td id="tdpicture1" align="left" valign="middle"><br><input name="picture1" id="picture1" class="button" value="Add Column" onclick="AddCol('add');" type="button"></td>
-
<td id="tddelete1" align="left" valign="middle"><br><input name="delete1" id="delete1" class="button" value="Delete Column" onclick="AddCol('del','1');" type="button"></td>
-
</tr>
-
</tbody></table>
-
</td>
-
</tr>
-
<tr>
-
<td align="left" valign="top" width="75">Description : </td>
-
<td align="left" valign="top"><textarea type="text" name="prod_description[]" id="prod_description[]" rows="8" class="textarea"></textarea></td>
-
</tr>
-
<tr>
-
<td align="left" valign="top">Features : </td>
-
<td align="left" valign="top"><textarea type="text" name="prod_feature[]" id="prod_feature[]" rows="8" class="textarea"></textarea></td>
-
</tr>
-
<tr>
-
<td align="left" valign="middle">Code : </td>
-
<td align="left" valign="middle"><input name="prod_code[]" id="prod_code[]" class="input" type="text"></td>
-
</tr>
-
<tr>
-
<td align="left" valign="middle">Price : </td>
-
<td align="left" valign="middle"><input name="prod_price[]" id="prod_price[]" class="input" type="text"></td>
-
</tr>
-
<tr>
-
<td align="left" valign="middle">Bend : </td>
-
<td align="left" valign="middle"><input name="prod_bend[]" id="prod_bend[]" class="input" type="text"></td>
-
</tr>
-
<tr>
-
<td align="left" valign="middle">2 Checkout ID : </td>
-
<td align="left" valign="middle"><input name="prod_co_id[]" id="prod_co_id[]" class="input" type="text"></td>
-
</tr>
-
</tbody></table>
-
</td>
-
</div>
-
gits 5,390
Expert Mod 4TB
so now ... have a look at the first line there:
[HTML]<div id="txthint1"><td class="tdTitle" align="left" width="600">
[/HTML]
so i assume now you want to remove that div? but as we see the id="txthint1' and not txtHint1 as you try to refer in your remove function?
kind regards
so the alerts you did are what you expected? ... then please post what the following alert says when you want to remove a node: - function removediv(){
-
var divno = document.getElementById('count').value;
-
var d = document.getElementById('txtHint'+0);
-
-
alert(d.innerHTML);
-
-
var divname ='txtHint'+divno;
-
var olddiv =document.getElementById(divname);
-
d.removeChild(olddiv);
-
}
hey gits just when i posted the last reply i saw the main error which is in the very first line see the id of the div :D it is "txthint1 not txtHint1 :D man that was very common but irritating mistake and was occurin in the mozilla because mozilla is case sensitive and explorer is not thats why it was deleting in the IE but not mozilla thanks to you gits you made a goooood ALERT() cheers many thanks
regards,
omer
so now ... have a look at the first line there:
[HTML]<div id="txthint1"><td class="tdTitle" align="left" width="600">
[/HTML]
so i assume now you want to remove that div? but as we see the id="txthint1' and not txtHint1 as you try to refer in your remove function?
kind regards
:D yeah i just got late poting the reply but i also saw the error and mentioned in my post any ways thanks aloots Gits
You are the MAN ;)
regards,
omer
gits 5,390
Expert Mod 4TB
no problem ... the alert just showed you what i was trying to explain before :) ... glad to hear you got it working now :)
kind regards
no problem ... the alert just showed you what i was trying to explain before :) ... glad to hear you got it working now :)
kind regards
:) thanks a bundle :)
regards,
omer
Good spot, gits.
that was very common but irritating mistake and was occurin in the mozilla because mozilla is case sensitive and explorer is not thats why it was deleting in the IE but not mozilla
That's shoddy by IE. JavaScript is case-sensitive, not case-insensitive like VB.
Good spot, gits.
That's shoddy by IE. JavaScript is case-sensitive, not case-insensitive like VB.
:) what to say ?...... any ways thanks alot guys ,
regards,
omer
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jimmy |
last post by:
Hi everyone,
I am working with a binary tree, and I am having a bit of trouble
visuallizing what needs to happen when I am trying to
delete a node that has two children. (no child node and one...
|
by: Grant Wagner |
last post by:
There doesn't seem to be any mechanism to "clear" a node of all
it's children (not that its necessary very often, but I have come
across situations where I'd like to clear a node of all it's...
|
by: kaeli |
last post by:
Can anyone explain this to me? It's driving me insane.
Save this and run it in IE or Opera and then in Mozilla or Netscape 6+.
In IE/Opera, I get the expected 4 alerts.
In Mozilla/Netscape, I...
|
by: e-mid |
last post by:
Here is an xml structure. i want to remove <a> nodes that do not have any
child. How can i do that in csharp?
<root>
<a>
<b/>
</a>
<a/>
<a/>
<a>
<c/>
|
by: Greg |
last post by:
Hi. I have a rather large xml document (object) that can have one or
more nodes with a certain attribute throughout (at ANY depth, not at
the same level necessarily). I need to find this...
|
by: Progalex |
last post by:
Hi, I have a treeview, called Treeview1 with one father node and some
children nodes. Number of children nodes can change since every child node is
a file name that the user add through an Open...
|
by: Jack |
last post by:
Hello,
I am trying use a TreeView with checkboxes. I would like to check more than
one node and allow all child nodes of selected nodes to be checked or
unchecked with the parent is checked.
...
|
by: Simon Hart |
last post by:
Hi,
I have a requirement to remove the xmlns from the DOM in order to pass over
to MS CRM 3.0 Fetch method.It seems the fetch method blows up if there is a
xmlns present!?!
The reason I have a...
|
by: WebDunce |
last post by:
Hi guys,
I am trying to develop a simple xml editor. I have an object that has a TreeView. I use the TreeView to display the Xml node info. That's all fine, but i want the user to be able to move...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |