dom

Supply a different DTD location to SimpleXML / DOM for XML parsing

I have a problem with supplied XML files which don't have the right location in the XML. I'm trying to get correct XML files, but we might not succeed in getting those so I am looking at alternative solutions. As the DTD is available online, I could do a regex on the XML file and replace the DTD location, but this feels a bit hackish, an...

How to select recently appeded element in jquery?

I want to select recently created element doing something like this: $("body").append("<div id='popup.dialog'></div>"); dialogDiv = $("#popup.dialog"); But after execution of this dialogDiv contains nothing. So is there're way to select newly createn element? ...

An easy way to generate HTML from top to bottom using jquery

I am trying to process a JSON response and generate HTML from it. I would like to construct HTML "top to bottom": entry = document.createElement('div'); entry.class = "Entry"; entry_title = document.createElement('div'); entry_title.appendChild(document.createTextNode('My entry title')); // and so on I would like to use jquery's HTML ...

Replace all references to external files (images, CSS and JavaScript) with flat directory references?

I'm trying to figure out if there is a way (using JavaScript, or jQuery) to go through an entire HTML file replacing all references to external files and replace all the references to files in other directories with the same named file, but without directory information. For instance, in the HTML text: scripts/script.js gets replaced ...

change html text from link with prototype

Hello, a simple question here Is there a way to change the text "click here" <a id="a_tbnotesverbergen" href="#nothing">click here</a> in this link using prototype? ...

Scrolling an HTML page with javascript?

I created a page that scrolled via JavaScript but in some browsers it does not scroll very smoothly when you and text to the page? And it doesn't seem to work at all in chrome. My question is: What is the best method to create smooth scrolling html pages using JavaScript that works cross browser. To get an idea of what I was trying ...

DOM events and target element

Hello everyone, here come my problem I am registering dblclick event on some p tags, when the user double click on this tag he can edit the content. So far so good the only problem if the p tag contain other tags and the user click on this only the content of that tag is editable. to clarify a bit here come an sample <html> <head...

How to manipulate DOM with Ruby on Rails

As the title said, I have some DOM manipulation tasks. For example, I want to: - find all H1 element which have blue color. - find all text which have size 12px. - etc.. How can I do it with Rails? Thank you.. :) Update I have been doing some research about extracting web page content based on this paper-> http://www.springerlink.com...

JavaScript/jQuery: Offset a <DIV> based on another <DIV> height after page load

Hi, I'm trying to do this: !!! just learned I cant submit images because I'm new... I have placed the image which perfectly describes the problem on Diino: Link to Diino folder (18,9kb) together with example files (html,css etc). The moving DIV has this CSS: div.linkr-bm { float:left; height:1px; overflow:visible; positio...

Html element size when not visble?

do elements before they are part of the dom have the width and height set properly? ie if I create a div containing markup can I measure its intended width and height without appending it to the dom? ...

Creating a document from a string in Gecko

I have a string such as <html><body><div id="message">Hello World!</div></body></html> and I would like to get the content of the #message element without parsing the HTML myself. I thought maybe I could create a document object from a string in Gecko (this is for a Firefox add on) but I don't see any simple way. I noticed that ther...

Does jQuery automatically remove attached even handlers from objects when I remove them?

Well my interest is whether jQuery does remove attached event handlers from the DOM object and all it's descendants (if they got some event handlers attached as well), if I just remove that DOM object with jQuery('.selector').remove()? ...

Resize flash video player to fill the page

Hello, I have a flash video player in a div inside a webpage, I'm trying to create a button that will resize this div to fill the whole page and hide everything else behind it. Has anyone tried to do it? Problems: 1. It causes the flash to reload and the video to restart 2. In some cases a flash banner from the webpage overlays my vide...

create JQuery object by passing DOM object?

So, let say I have this: var d = document.createElement('div'); d.id = "whatever";` So, d is the DOM object, how can I create or convert it into jQuery object? e.g. $(d) ??? and, how to 'read' all attributes of the jQuery object? just like the var_dump of PHP. ...

Using class as a field name in JDT dom

Hello, I'm trying to add a call to the StaticClassName.class field access to an existing class using JDT's Dom methods. I get an IllegalArgumentException when I try to create a simple name using ast.newSimpleName("class"). I think this is because JDT treats it as a keyword when it is also used as a field name. Is there anyway to make ...

How to find the snippet of JavaScript that modifies an element?

The page I'm trying inspect has a hidden <input type="hidden" name="Foo" value="123 /> element on a page, where Javascript/AJAX modifies the value. I'm trying to find where on earth in Javascript is the code that modifies this value from time to time. Is there a tool that could help me find the places in javascript that use/modify that ...

Can I see the resulting markup after JavaScript Dom manipulation?

Is there any way to get a browser (or some other program) to show me the DOM of a web page, as modified by JavaScript code? For example, say I have some simple markup. I then use some JavaScript (say, via jQuery) to add classes, move things around, etc. Is there any way to "view source" on the modified version, as it would look if that ...

Replace some text from any HTML page before it is displayed

I would like to hide any text matching a pattern from any HTML page, before it is displayed. I tried something like that with Greasemonkey : var html = document.body.innerHTML; html = html.replace( /some pattern/g, '???' ); document.body.innerHTML = html; The text I want to hide is correctly replaced with '???', but for a brief momen...

Animation for adding DOM elements with jQuery

At the moment I'm adding elements to a page on a click event using after. I'd like to animate this in some way so the new elements don't suddenly appear out of nowhere. I'm not bothered what animation method is used as long as it shows to the user what is happening when they click. I've never used animation in jQuery before and have on...

How to close an iframe?

After opening an iframe, I sometimes need to close it. Thus far, I just remove the iframe from its parent node, thus cutting it off from the DOM. However, I'm finding that this doesn't immediately end the iframe's life, and its javascript code can still call back into the parent window, which no longer expects these callbacks. How can...