dom

How can you access an external iframe's contents via the DOM/Javascript?

I have a page thusly: <html> <body> <iframe src="local.html"></iframe> <iframe src="http:www.google.com"></iframe> </body> </html> I've used the DOM to access the first iframe as a test (node.documentWindow) but when I try similar on the external iframe Firebug reports that access is denied. I suspect this is ...

How to programmatically click an element with MooTools?

In jQuery, I've done stuff like this in the past: $('#someCheckbox').click(); And everything works as if the user just clicked on the element normally. However the same doesn't work in MooTools: $('someCheckbox').fireEvent('click'); The checkbox doesn't get checked, nor do any of the bound event handlers fire. Is there a way to d...

Get tag name and value of a given node using XMLReader, DOM, Xpath

I need to query an xml document and then display specific tag values, e.g. forename, surname, group(dept), job_title. I'm using XMLReader as i may need to work with large XML files. I using DomXPath to filter the data, but i don't know how to retrieve the nodeName and value for each element. The code below only returns 'member' as the...

Is there any way to access parent dom object from the child element ?

Hi, I have a simple DOM code like the following <div> <div> </div> </div> I want to set the background color of the outer div using the inner div alone. Is it possible? The question might be a bit crazy. But I have a strong reason behind asking that. I am working on a framework where there are html code generated dynamically...

Class as an Event Observer

I want to do something like this... var Color = Class.create({ initialize: function() { this._color = "white"; this.observe("evt: colorChanged", this.colorChanged.bind(this)); }, changeColor: function(color) { this._color = color; this.fire("evt: colorChanged"); }, colorChanged: functi...

Manipulating the DOM tree

Hi, If I load a page in an iframe, run doc.querySelect to retrieve a node N, append N to doc.body by doc.body.appendChild(N), and then remove all children from doc.body until it reaches N, would N be guaranteed to be rendered the same way as pristine in Firefox or IE? So far in the example that I have tried, it's alright, but I was wond...

How to change <title> with delay?

I know in jQuery 1.4.x there is a method delay(). We can use it like this: $('#block').slideUp().delay(2000).slideDown(); and it works great. But i want to modify document.title, but this construction doesnt work: $('title').html('New title 1').delay(2000).html('New title 2'); when you run this code title will be New title 2 avoid ...

Using JavaScript/jQuery to return a list of CSS selectors based on highlighted text

I've been given some project requirements that involve (ideally) returning a list of CSS selectors based on highlighted text. In other words, a user could do something like this on a page: Click a button to indicate that their next text selection should be recorded. Highlight some text on the page. See a generated list of CSS selector...

How To Select A Range in an Iframe With "Start" and "End" in Firefox like "selectionStart" from inputs element

Hi, for Internet Explorer, I have the current code to select a range in an iframe with desingMode setting to on: var Range = window.document.selection.createRange(); var obj = { start: 3, end : 6} Range.collapse( true ); Range.moveStart( 'character', obj.start ); Range.moveEnd( 'character', obj.end - obj.start );...

php dom get all attributes of a node

is there any easy way of getting all attributes of a node without checking if it has that attribute? short, here's an example of what i'm trying to do: i have this short domdocument: <p align=center style="font-size: 12px;">some text</p> <a href="#" target="_blank">some link<a/> okay.. now if i check p tag with getAttribute('align') i...

I have a dynamic form with lines addes to the dom with jquery, and the total price seems to be acting strangly

I can add and remove the last line in my dynamic form and calculate the sum of the unit prices but the calculateSumNoTax() function seems to only be fired bu the first line which is output by php, every other line appended to the dom via jquery dont fire calculateSumNoTax(); What am I doing wrong here ? JS : $(document).ready(functio...

How to find an element inside another element in mootools

Let's say i need to find all .bar elements inside an element that's assigned to a variable foo. In jQuery, foo.find('.bar') solves the problem. What's the equivalent function in mooTools? ...

How does it work? - Javascript function to make non-IE fixes using YUI

Here's the code I'm trying to understand: noniefix.js: function fixNonIE() { if(YAHOO.env.ua.ie > 0) { return false; } var divs = YAHOO.util.Dom.get('bd').getElementsByTagName('div'); if(divs.length > 0) { YAHOO.util.Dom.batch(divs, pushup); alert (divs.length+" divs in file!"); } } function pushup(el) { if(el.id.search('f...

How can I test if two jQuery wrapped DOM elements are the same?

I'm writing a sortable list implementation in jQuery (b/c of the infamous scroll-in-div issue, any new solutions for this?). However, I don't know how to compare the elements (triggered on mousedown/mouseup) after they've been wrapped in jQuery. In prototype, it was always ele.domNode. This is what I'm trying to accomplish in essence......

Image visualization with canvas. How to resize them?

I'm building a website photo gallery for a friend. Images are loaded as simple DOM image objects (<img src="" />), and the size of these images is based on the browser size. So I resize them with CSS. This isn't an optimal solution since CSS resizing seems to change the quality of the image and pixelate it quite a bit. I was thinking o...

"Proprietary" HTML tags in HTML 4.01

My last company, which used 4.01 DOCTYPE exclusively, decided to add some new functionality based on use of proprietary tags in the form of <pp:foo attrOne="something" attrTwo="something else"/> for certain purposes in their .aspx pages. In the beginning they broke a lot of Javascript until I sussed out that when these proprietary tag...

jQuery + Greasemonkey, Click event doesn't trigger on correct element?

$(Constants.Selectors.Submit_Button).bind('click', function () { GM_log('Event run: id = ' + this.id + ' self = ' + this); }); The above code appears to run when the click event is triggered by the document (or otherwise some other all-page encompassing element or set of elements.) The console output is this: Script: Event run: id ...

Extend DOMElement object

How could I extend objects provided with Document Object Model? Seems that there is no way according to this issue. class Application_Model_XmlSchema extends DOMElement { const ELEMENT_NAME = 'schema'; /** * @var DOMElement */ private $_schema; /** * @param DOMDocument $document * @return void ...

using XPath to find node under a context node does not work (firefox/firebug/javascript)

I want to extract information from a web page. The page has m nodes, which can be found by .evaluate("//div[@class='news']", document, ....). For each of the above nodes, there are 3 nodes inside them. Each of them has different @class selector. And I want to extract these m 3-tuple records. I tried to use .evaluate() function as inst...

Javascript: Let user select an HTML element like Firebug?

I want to write a browser (Chrome/FF) extension that needs to select an element on a web page. I would like it to behave like Firebug's element inspector does. You click the inspect arrow and you can then hover/highlight elements. When you click on the element you want, the element is inspected. I'm just interested in the code to all...