Hello,
On index.html page I have a table with id="property_fi elds".
<table id="property_fi elds" name="property_ fields" border="0">
It contains set of rows with the following IDs:
var propertyRows = new Array(
"region_row ", "town_row", "district_r ow", "address_ro w", "house_row" , "floor_no_r ow", "rooms_row" , "floors_row ", "area_row", "year_built_row ",
"ownership_row" , "standard_r ow", "garrage_ro w", "parking_ro w", "kitchen_ro w", "balcony_ro w", "gas_row", "media_row" , "equipment_row" , "guard_row" ,
"building_type_ row", "picture1_r ow", "picture2_r ow", "picture3_r ow", "property_remar ks_row"
);
I want to remove row if it is not required - it depends on the selection of
estate_type control:
for (var r = 0; r < propertyRows.le ngth; r++)
{
if (visibility[document.announ cement.estate_t ype.selectedInd ex][r] == 0)
{
var theRow = document.getEle mentById('prope rty_fields').ro ws[r + 1];
document.getEle mentById('prope rty_fields').re moveChild(theRo w); // HERE
PROBLEM: nothing happends
}
}
(there's 2-dimensional table called visibility).
The problem is that removeChilds() does nothing, there is no visual effect.
I use FireFox in Linux.
Please help. Thanks in advance.
/RAM/ 10 3190
On Jul 1, 3:38 pm, r_ahims...@pocz ta.onet.pl wrote:
On index.html page I have a table with id="property_fi elds".
<table id="property_fi elds" name="property_ fields" border="0">
<snip>
var theRow = document.getEle mentById('prope rty_fields').ro ws[r + 1];
document.getEle mentById('prope rty_fields').re moveChild(theRo w);
// HERE PROBLEM: nothing happends
In HTML documents/DOMs TR elements are not children of TABLE elements
(though in XHTML documents/DOMs they may be) but rather the children
of (possibly implied) TBODY, THEAD or TFOOT elements, so your - theRow
- is not a child of the element on which you are calling - removeChild
- and as a result the method call is non-effective. A relatively
simple fix would be to call the - removeChild - method of the element
that was the - parentNode - of - theRow -. I.E:-
theRow.parentNo de.removeChild( theRow); r_********@pocz ta.onet.pl wrote:
On index.html page I have a table with id="property_fi elds".
<table id="property_fi elds" name="property_ fields" border="0">
`table' elements don't have a `name' attribute.
It contains set of rows with the following IDs:
var propertyRows = new Array(
"region_row ", "town_row", "district_r ow", "address_ro w", "house_row" , "floor_no_r ow", "rooms_row" , "floors_row ", "area_row", "year_built_row ",
"ownership_row" , "standard_r ow", "garrage_ro w", "parking_ro w", "kitchen_ro w", "balcony_ro w", "gas_row", "media_row" , "equipment_row" , "guard_row" ,
"building_type_ row", "picture1_r ow", "picture2_r ow", "picture3_r ow", "property_remar ks_row"
);
I want to remove row if it is not required - it depends on the selection of
estate_type control:
for (var r = 0; r < propertyRows.le ngth; r++)
{
if (visibility[document.announ cement.estate_t ype.selectedInd ex][r] == 0)
{
var theRow = document.getEle mentById('prope rty_fields').ro ws[r + 1];
document.getEle mentById('prope rty_fields').re moveChild(theRo w); // HERE
PROBLEM: nothing happends
}
}
(there's 2-dimensional table called visibility).
The problem is that removeChilds() does nothing, there is no visual effect.
Depends on how you define that. There is an exception in the Error Console.
I use FireFox in Linux.
The `tr' element is the child of a `tbody' element, not of the `table'
element, and repeated reference lookup is inefficient.
var sel = document.forms["announceme nt"].elements["estate_typ e"];
var selIdx = sel.selectedInd ex;
if (selIdx -1)
{
var table = document.getEle mentById('prope rty_fields');
if (table)
{
var tbody = (table.tBodies || [null])[0];
if (tbody)
{
for (var r = propertyRows.le ngth; r--;)
{
if (visibility[selIdx][r] == 0)
{
var theRow = tbody.rows[r + 1];
tbody.removeChi ld(theRow);
}
}
}
}
}
I presume `r + 1' is because you want the table header to stay in. If you
put that row into a `thead' element and the rest explicitly in the `tbody'
element (that is always there), you can use `r' instead.
You should use two or four spaces for indentation instead.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Henry wrote on 01 jul 2008 in comp.lang.javas cript:
>
theRow.parentNo de.removeChild( theRow);
Why is this spec-ed in this strange double way?
A child can only be a child of it's parent,
in this asexual DOM world?
Could we forget about .removeChild()
if we have the below function removeElement() ?
function removeElement(x ) {
x.parentNode.re moveChild(x);
};
=============== ==============
and consequently:
function removeElementBy Id(x) {
x = document.getEle mentById(x);
x.parentNode.re moveChild(x);
};
Not tested!!!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
You should use two or four spaces for indentation instead.
I would disagree, It's a chore to use code which has been written
using spaces as indentations when your trying to line up braces and
debug code. Useing tabs allows you to move things around quiker.
Using spaces does look nicer, but for jigging code around I much
prefere to use tabs.
On Jul 1, 3:20 pm, yukabuk <yuka...@google mail.comwrote:
>You should use two or four spaces for indentation instead.
I would disagree, It's a chore to use code which has been
written using spaces as indentations when your trying to
line up braces and debug code. Useing tabs allows you
to move things around quiker. Using spaces does look nicer,
but for jigging code around I much prefere to use tabs.
Thomas' statement is possibly insufficiently qualified. Code posted to
this group should not be formatted/indented with tabs because
newsreader software has been observed to default the number of spaces
per tab used for presentation to values at least in the range zero to
8, and may or may not offer the user the opportunity to set an
alternative). Having a tab converted to zero spaces renders it
useless, and in general 8 spaces pre tab would be too many, and tend
to quickly force line length over the suggested 72(ish) character norm
and result in code that is broken by automatic line wrapping.
Code should be presented to the group with formal indentation, pre-
line wrapped to avoid any automatic line wrapping, and executable
following a cut and paste from the newsreader. Indenting such posted
code with (small numbers of) spaces considerably helps in those
regards.
yukabuk wrote:
>You should use two or four spaces for indentation instead.
I would disagree, It's a chore to use code which has been written
using spaces as indentations when your trying to line up braces and
debug code. Useing tabs allows you to move things around quiker.
Not with a decent editor. Using tabs especially provides inconsistent
display among editors and pagers.
Using spaces does look nicer, but for jigging code around I much
prefere to use tabs.
This recommendation was merely about posting code here, however with a
decent editor there is no need for tab characters in editing as well, while
still minimizing the keystrokes for formatting code.
For example, I use Eclipse's WTP/WST/JSDT editor, with which I can increase
indentation by one level, two spaces, by pressing the Tab key, and decrease
it by the same amount of spaces by pressing Shift+Tab. This also works for
multi-line selections. <http://www.eclipse.org/webtools/>
When quoting, please include, and don't remove, the attribution line.
<http://www.jibbering.c om/faq/faq_notes/clj_posts.html>
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
On Jul 1, 4:16*pm, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
(...)
Could we forget about .removeChild()
if we have the below function removeElement() ?
function removeElement(x ) {
* * * * x.parentNode.re moveChild(x);
};
(...)
Yes, but don't forget to return the removed element :
function removeElement(x ) {
return x.parentNode.re moveChild(x);
};
So that the calls can be nested :
document.body.a ppendChild(remo veElement(e));
--Jorge.
Jorge wrote on 01 jul 2008 in comp.lang.javas cript:
On Jul 1, 4:16*pm, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
>(...) Could we forget about .removeChild() if we have the below function removeElement() ?
function removeElement(x ) { * * * * x.parentNode.re moveChild(x);
}; (...)
Yes, but don't forget to return the removed element :
function removeElement(x ) {
return x.parentNode.re moveChild(x); };
So that the calls can be nested :
document.body.a ppendChild(remo veElement(e));
function removeElement(e l) {
return el.parentNode.r emoveChild(el);
};
function transplantEleme nt(el,targ) {
targ.appendChil d(removeElement (el));
};
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
On Jul 1, 10:33*pm, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
Jorge wrote on 01 jul 2008 in comp.lang.javas cript:
On Jul 1, 4:16*pm, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
(...)
Could we forget about .removeChild()
if we have the below function removeElement() ?
function removeElement(x ) {
* * * * x.parentNode.re moveChild(x);
};
(...)
Yes, but don't forget to return the removed element :
function removeElement(x ) {
* * * * return x.parentNode.re moveChild(x);
};
So that the calls can be nested :
document.body.a ppendChild(remo veElement(e));
function removeElement(e l) {
* *return el.parentNode.r emoveChild(el);
};
function transplantEleme nt(el,targ) {
* *targ.appendChi ld(removeElemen t(el));
};
function transplantEleme nt(el,targ) {
** return ** targ.appendChil d(removeElement (el));
};
transplantEleme nt(e, body).className = "bodyStyle" ;
--Jorge. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sarah Haff |
last post by:
Hi,
What would be minimilistic XSLT that does "nothing" (no
transformation) to the given XML content.
Thank you.
Sarah Haff
|
by: Joe Philip |
last post by:
I created a file called data.del using export like this:
export to data.del of del select * from sy9.c001
Now, I want to import this data to a different database into a different
table. This table does not already exists in the database. For example, I
tried this:
import from data.del of del insert into c001prod
When I do this, I get...
|
by: dhnriverside |
last post by:
Hi
I'm trying to create some JS to enable/disable some form elements when a
radio button grp is set to a certain option.
However, the Attributes.Add method does nothing...
html..
<asp:radio button id="rdoOption1" runat="server" GroupName="ioptions" />
|
by: siddharth |
last post by:
when i am finding a particular row in a database through a
datatable.row.find(the particular text to find) it gives me table does
not have primary key
although it has a primary key
|
by: Naha |
last post by:
Hi guys,
Having a problem, my table does not get displayed, when i load the page it gives me the following error(p.s-the codes below):
<%@ page import="java.util.*,java.io.*" %>
<%@ page import="testBean.TestBean" %>
| |
by: Marc Gravell |
last post by:
I have a handful of ClickOnce installs that work fine almost
everywhere... however, on some machines it simply does nothing! These
are regular VS2005 ClickOnce "publish" deployments, signed with a
valid certificate.
The client correctly detects the MIME, prompts the user, downloads the
files, etc - and the system deployment log (temp...
|
by: muhremehr |
last post by:
hi all
can someone one help me why this code does nothing to my database ?!!
Sub Main()
Dim da As New
AdventureWorks_DataDataSetTableAdapters.EmployeeTableAdapter()
Dim employees As AdventureWorks_DataDataSet.EmployeeDataTable = _
da.GetData()
|
by: Philipp.Weissenbacher |
last post by:
Hi all!
This is most certainly a total newbie question, but why doesn't the
following code cause a segfault?
void insertion_sort(int a, int length)
{
int i;
for (i=0; i < length; i++)
{
int j, v = a;
|
by: Knut Ole |
last post by:
hi,
the acCmdDeleteRecord seems to be working, but in fact does nothing in the following code. (line 10.) If virginr = True Then
strMsg = "Do you really want to CANCEL the new reservation?"
If vbYes = MsgBox(strMsg, vbYesNo + vbQuestion + vbApplicationModal, "Cancel Reservation") Then
DoCmd.RunCommand...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |