dom

Convert HTML DOM into a multidimensional array

Where keys are represented by element type and values are represented by #foo and .bar (spaced and ready for explode()). Is it possible, or does something exist for it? I know that this question might incite some wrath, and I'm hoping nobody links to that post about parsing HTML, but I'm hoping it's not impossible. Thanks for the help. ...

How to get some xml that comes before and a little from after a DOM Node.

I am using java and I am pretty open to using w3c DOM or DOM4J at this point. So lets say I have a Node like a text node that I have found something interesting in, like say an occurrence of a substring in the nodes text. If I want to get a string with a number characters preceding that node and a few characters after that node how may ...

Dragging a div along with all of its child divs

I have the following code: <body> <div id="container" style="position:absolute; left:0px; top:0px; z-index:1;"> <div id="div1" style="background-color:Red; position:absolute; left:0px; top:0px; width:256px; height:256px; z-index:0;" >&nbsp;</div> <div id="div2" style="background-color:Black; position:absolute; left:2...

Why does this JavaScript not correctly update input values?

I have two input fields, and without changing their names (i.e., I have to use the name with the brackets), how do I make this javascript code work? <script> function calc_concreteprice(mainform) { var oprice; var ototal; oprice = (eval(mainform.['concrete[concrete][sqft]'].value) * eval(mainform.['concrete...

XML DOM parsing with Java

I'm trying to parse this XML string: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <response type="success"> <lots> <lot>32342</lot> <lot>52644</lot> </lots> </response> When I get the root node, which is "response", I use the method getChildNodes() which returns a NodeList of length 3. However what I'm con...

javascript conflict on accesing DOM

i read this statement from a book i read The Document Object Model or DOM is really not a part of JavaScript but a separate entity existing outside it. Although you can use JavaScript to manipulate DOM objects, other scripting languages may equally well access them too. what is the best way to avoid conflict between javascript and o...

How do I get all supported CSS properties in WebKit?

In Firefox, Opera and IE I can get them via: >> for (k in document.body.style) console.log(k) -> opacity background height textAlign . ... long list ... . pointerEvents In WebKit the result is quite different: >> for (k in document.body.style) console.log(k) -> cssText length parentRule getPropertyValue ...

Lazy-loading flash objects

I'm using the jQuery lazy-loading plugin to defer loading of below-the-fold images on a large web page. This works great. Now, I would like to apply the same technique to a large Flash object which is also below-the-fold. I don't think the lazy-load plugin handles things that aren't images (at least it doesn't look that way so far.) I ma...

Creating <li> with JavaScript in an XUL Application

Hi! I try to create some li elements in my XUL Application. Theres only the text of the elements shown, but no list typical bullets and linebreaks. Example: text text text text text text text Heres the JS Code I use to create the list: var li = document.createElement('html:li'); var txt = document.createTextNode("only shown as ...

Var null and not an object when using document.getElementById

Hi, I'm doing some work in HTML and JQuery. I have a problem of my textarea and submit button not appearing after the radio button is selected. My HTML looks like this: <html> <head><title>Publications Database | Which spotlight for Publications</title> <script type="text/javascript" src="./jquery.js"></script> <script src="./addSpo...

Javascript: how to tell if a node object has been inserted into a document/another element yet

I'd like to be able to identify whether a given DOM node has been appended/inserted into another node yet, or whether it is fresh out of document.createElement() or similar and has not been placed anywhere. In most browsers just checking the parentNode works. if (!node.parentNode) { // this node is not part of a larger document } H...

How to get all available options of a combobox in a webpage using C#

Suppose we have a combo box in a web page which have 24 options in its drop down. I have loaded the page in a web browser control hosted in a windows application. Now how can I populate all the options for the combo box using its tag by C#? ...

Javascript dom tree modification

Hi all, Whats the wayto modify the "body" of a dom tree like this using javascript: Original htm: <html> <head></head> <body> blah blah blah </body> </html> Modified html: <html> <head> </head> <abc> <body> blah blah blad </body> </abc> </html> That is, I wish to put the whole body node inside another node. The code I...

DOM innerHTML Duplicate Problem

function SwapPlans(city, id) { var tp = GetTravelPlanById(id); var content = MakeHTMLAccordionMe(tp.items[0]); document.getElementById(city).innerHTML = " "; document.getElementById(city).innerHTML = content.innerHTML; document.getElementById(city).outerHTML = " "; document.getElementById(city).outerHTML = conten...

Is there any ideas about create HTML DOM object pool?

In RIA, especially very complicate such as google WAVE. For browser's DOM object recycle system is not smart, I think put all DOM object into an object pool maybe a good idea to avoid create too much useless DOM node. Can anyone give me some advice? ...

How to display the dynamically created elements for some time?

i have some rows of data displayed in a table and on mouse over of each row i've list two buttons inside a div element and then display it for some time. And i've associated some functions to be called on clicking the buttons that are dynamically created and displayed elements.. So what i did was i wrote a function which will create ele...

Separating Javascript and Html, when dynamically adding html via javascript

I am currently building a very dynamic table for a list application, which will basically perform basic CRUD functions via AJAX. What I would like to do is separate the visual design and javascript to the point where I can change the design side without touching the JS side. This would only work where the design stays roughly the same(i...

DOM innerHTML does not accept my html data

var popupcontent = myfunc(item.Id, i); tablepopup = document.createElement("table"); tablepopup.innerHTML = popupcontent; highSlide.appendChild(tablepopup); tdAnkunft.appendChild(kirmiziOkLink); tdAnkunft.appendChild(highSlide); tableRow.appendChild(tdAnkunft); Hi, myfunc returns an html table code like "ta...

What's faster DOM Insertion or Manipulation?

Hi all, Am I better to move a node I sent down form the server or to insert it? I'm using jQuery (1.4) but would like to know for both jQuery and JS in general. In this case the node is small with only one child. But what if it were a large list? What large list 1 = 200 li nodes large list 2 = 1000 li nodes Example: Insertion: <d...

Accessing the value of an input element with XPath in an XSLT

Hi! I'm developing a web app for Firefox that has a button that triggers a client-side XSLT transformation of the document's DOM, with a stylesheet fetched via AJAX. Here's a portion of the XHTML that's going to be transformed: <html> <head> <title>Static Javascript-based XMR Form Creator</title> </head> <body> <h1 id="title">...