Dom Walking For Dummies

Dec 20, 2006

I'm working on a little javascriptlet/greasemonkey script, and I've run
into a challenge that I think can be solved with walking the DOM, but I
feel like I'm kludging my way through and wondering if there might be a
better answer out there.

Here's the problem: I want to insertCell(0) into an existing table, but
the table doesn't have a NAME or ID. I don't have the option of adding
these (it's for Wikipedia) and would like to programatically navigate
my way to the table. The table is inside a FORM element that _does_
have an ID, so it's pretty close to a known entry point. I was
originally planning on using .firstChild a few times in a nested
sequence to work my way down to the table, but it's proving trickier
than I thought it would, hence my question here. Code:

View 8 Replies


ADVERTISEMENT

Walking DOM Query

Nov 28, 2006

I have a ul I want to access via the DOM that is here:

<div id="options>
<form>
<div>
<div>
<span>Some text</span>
<ul>
...
</ul>
</div>
</div>
</form>
</div>

Each child of #options has text nodes besides the HTML elements. Short of doing

document.getElementById('options').childNodes[1].childNodes[1].childNodes[1].childNodes[3]
or giving the UL an ID, is there any other way I could access that UL? I'm imagining something like an array containing every single child (even grandchildren, etc.) of #options but I don't know if it exists. I know the most sensible thing to do is to give the UL an ID, but I'm curious.

View 3 Replies View Related

Delete Confirmation For Dummies?

Dec 26, 2010

On my page, I have a delete button. But when I press trhe button to delete, I put a standard javascript confirm pop-up window with a "Are you sure..." How do I change the message to read "Are you sure you want to delete the member firstName, LastName"? So that an idiot would know who they are deleting?

View 4 Replies View Related

JQuery :: Online Website Builder For Dummies

Nov 16, 2010

After playing with all of the different jQuery interactions, widgets, visual effects, etc. (on the demo pages), I wonder of there is an online website builder that would allow me to easily create web pages with all of these functions, but without having to do any real programming ?

View 2 Replies View Related

JQuery :: Code To Use To Mask A Phone - Maskedinput For Dummies ?

Aug 6, 2011

I'm trying to use the plugin at [url] for a form. All the examples I find seem to assume I already have worked with javascripting for 30 years and have 3 PhD's in computer science or they have the code buried in a bunch of other bells and whistles, etc. Can someone show the full code to use to mask a phone # using (999) 999-9999 as the mask assuming the formstarts as follows:

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved