dom

JavaScript: Appending children to element

Which technique below is better from a user experience? In both examples, assume that thumbContainer is set to the return value of document.getElementById('thumbContainer'), and new Thumbnail(thumb).toXMLString() returns a string with XHTML markup in it. A) Simply += with thumbContainer.innerHTML: for (thumb in thumbnails) { thum...

DOM node child collections--what's the difference?

What's the difference between the children and childNodes collections of a node? And childElementCount and childNodes.length? ...

Insert after parent of element

What sort of selector would be I need in order to insert after the parent (divouter) of the test3 class in the example below? Thanks. <div class='divouter'> <div class='divinner'> <input class=test1></input> </div> </div> <div class='divouter'> <div class='divinner'> <input class=test2></input> </div> </d...

DOMDocument->saveHTMLFile saving escaped text

I am trying to save a string of html into the nodeValue attribute of a DOMElement in PHP, but after I save the file with DOMDocument->saveHTMLFile the string of HTML is escaped and I can not figure out how to get the string not be saved as escaped text. Any ideas? ...

<canvas> VS DOM in javascript game dev

what are adventages and disadventages of creating games in 'pure' DOM and using canvas? ...

Accessing cell text in Javascript

Hello, I am trying to change the text of a table cell when only the <table> element has an ID, there are no IDs set on the cells, e.g. <table id="test"> <tbody> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> </tbody> </table> So how do I change the text of the second cell (Cell 2) in Javascript without explicitly ...

Add a border around a fixed-width SVG?

I'm unfamiliar with the SVG spec, so I was wondering if there was an easy way to build a border of a certain width around a fixed-width, rectangular SVG simply by manipulating the DOM. This seems like it should be feasible, but I don't know where to prod to begin. Help? ...

DOMException while cloning XML Node

Hi, The cloneNode() method in the following minimal example works on java 1.6 but throws an DOMException with code 14 under android 5. Code 14 according to sdk docs means: "NAMESPACE_ERR If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces." Has anybody an idea why this might be? Th...

How might I add and remove table rows whilst maintaining sequential element IDs?

I am developing the back end of a CMS that I have been working on. I have a HTML table that I want the user to be able to add and remove rows from. Each row will contain various user inputs (textboxes, checkboxes..). Then when the users has finished it will be saved in the database. I am wondering what the best way to approach it is. ...

Javascript - get all table -> tr > id values

I would like to access all the values of a table tr id field. <table> <tr id="1"></tr> <tr id="2"></tr> <tr id="3"></tr> <tr id="4"></tr> <tr id="5"></tr> </table> What I would like to do is, using a javascript function, get an array and have acess to [1,2,3,4,5] Thank you very much! ...

Is it possible to read the clipboard contents in Chrome without an onPaste handler?

Is it possible to read the clipboard without user interaction? Just like IE's window.clipdData.getData("Text")? I've seen other questions, such as Is it possible to read the clipboard contents in Firefox, Safari, and Chrome using Javascript?, but the onpaste event is not what we are looking for. ...

PHP SimpleXML DOM using between functions

Hi there, I have been trying to get my head around how simplexml and dom updates XML between functions. The reason i ask is that the code i have written seems to work, but without me having to declare anything as global, and im a little confused as to why it does this. For example, i have this (simplified) code: <? foreach ($filename...

Stuck selecting classes or id's using PHP Simple HTML DOM Parser

Hi everyone, I'm trying to select either a class or an id using PHP Simple HTML DOM Parser with absolutely no luck. My example is very simple and seems to comply to the examples given in the manual(http://simplehtmldom.sourceforge.net/manual.htm) but it just wont work, it's driving me up the wall. Other example scripts given with simple ...

JDI Thread Evaluations has encountered a problem

I'm running Eclipse for Java. I created a DOM version of an XML file. Now I want to change an attribute of an element in the file. I called a method that called a method in the class that controls the DOM, and I got a dialog box saying "JDI Thread Evaluations has encountered a problem. Exception processing async thread queue" while debug...

jQuery: Remove DOM element loaded via ajax

Hi, I'm using jQuery to load ajax content on to a page. However, trying to use jQuery's .remove() function doesn't seem to be working to remove the dynamically loaded element. My example function: function deletePerson(personID){ if (confirm("Are you sure you want to permanently delete this person?\nYou cannot undo this action.")...

Problem getting contents of class using php simple dom parser

Hi everyone, I can't work out how to get the contents of the second span 'cantfindme' using php simple html dom parser(http://simplehtmldom.sourceforge.net/manual.htm). Using the code below I can get the contents of the first span 'dontneedme'. I cant seem to get anything from second span at all. $html = str_get_html('<html><body><tab...

How does the GMail "Loading..." banner work?

Hello all, I am trying to replicate a feature of GMail in my own application. When changing folders in GMail, the display will stay on screen and a small loading banner will appear on the top of the site. This is desirable, since it prevents the screen from going all white and disturbing the users workflow on postback. I have tried to...

dom question: getting the full sourcode from a html document

hi all, i'm trying things out with a html document's dom (under visualbasic6) and i was wondering: how can i get the full html sourcecode including all headers? is there something like document.all.value? thanks ...

How to add doctype with ID attribute to the XML file in java?

Hi, I am dynamically creating a DOM object and need to add following doctype to the XML file in java: <!DOCTYPE MyXml [<!ATTLIST node id ID #REQUIRED>]> I am using org.w3c.dom, is there any way we can do this? Regards, Abhishek ...

What is an empty element?

According to the XML spec, this is the definition of an empty element: An element with no content is said to be empty.] The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (see: http://www.w3.org/TR/REC-xml/#NT-content) Now, I have no problem understanding empty...