dom

Closing windows that were opened by search query

Hello, Please go to http://musicalinstrumentsfinder.com/search.php The top search box is a super search box if you will in that whatever text you type in it will automatically be put in the individual search boxes below. Also, upon clicking the "Search All" button, it will automatically simulate a click on all the individual search box...

jQuery framework internals

Hi I am trying to understand the internals of how jquery framework is written and finding it hard to understand the code. Does anyone have any suggestions regarding a good way to get started. Thanks for all the useful input. Editing the topic since I had limited space for adding individual comments. I have written a lot of basic java...

How can I simulate a click to an anchor tag?

I know this is similar to this question and this question, but given solutions didn't address the "target" property. I want to simulate a click to an anchor tag with all extras like correct target handling. There seems to be a "click()" method for anchor's DOM object but not all browsers support that. Firefox throws this error: Err...

jQuery "Object doesn't support this property or method" in Internet Explorer

I am using jQuery to add some dynamic content to a website. I am attempting to create a new DOM element on-demand using the following code: container = $('<div id="myContainer"></div>'); This works perfectly in Firefox and Safari, but Internet Explorer is generating an error. The IE error is: Object doesn't support this property or ...

BHO: fast DOM manipulation

I´m writing a IE BHO using C++. I wait for the DOCUMENTCOMPLETE event. After that I remove some Elements from the DOM. On small websites it works fine but on the larger ones - the website is visible for a few seconds waiting for a few elements and after that the documentComplete event fires - and remove the elements. Is it posible to ap...

Node.TEXT_NODE and IE7

Hello. I've some javascript that tests DOM node types against like this: if(node.nodeType == Node.TEXT_NODE) { Of course, it all works fine in Firefox, Safari, and Opera. But Internet Explorer 7 is complaining that Node (with the capital N) is undefined. But that's part of DOM Level 2! Do I really need to change my code to us...

How to sort javascript object array by element.name

Hi, I am try to write some validation script using javascript and prototype. What I want to do is to loop through all the elements of a form and validate each answer. My code works, BUT the array of DOM elements is unsorted. I would like to sort the elements by their ID. Here is the my code, which works fine if I comment-out elem.s...

Reading window or tab URL bar

Hello, Let's assume that I have several tabs open within the same browser. Is there a way to go read the URL bar of each browser tab? Same question if instead of having several tabs open in the same browser, I have several browser windows open? I am thinking that there may be a way with the DOM but all I could find is that the root e...

How to remove all css classess using jquery?

Instead of individually calling $("#item").removeClass() for every single class an element might have, is there a single function which can be called which removes all css classes from the given element? Both Jquery and raw javascript will work. ...

Make programmatic range selection visible to the user?

How can I make a programmatical page selection visible to the user, as if it was selected by the user? var range = document.createRange(); var startPar = [some node]; var endLi = [some other node]; range.setStart(startPar,13); range.setEnd(endLi,17); Thank you. ...

Why is element.style.left returning NaN?

I'm getting a weird error where in Internet Explorer 7, when I call Math.round on a float it gives me an "Invalid Argument" error. Consider the following: var elementLeft = parseInt(element.style.left); // Here we're actually getting NaN function Foo(x) { this.x = x; this.apply = function(element) { element.style.left = Math.ro...

How to get specific content with PHP and DOM Document?

Howdy, I have a url I want to grab. I only want a short piece of content from it. The content in question is in a div that has a ID of sample. <div id="sample"> Content </div> I can grab the file like so: $url= file_get_contents('http://www.example.com/'); But how do I select just that sample div. Any ideas? ...

modeless window to behave like a modal window using javascript

Hi, I have a requirement to have some modal popups appear on a webpage. At first i implemented them as true modal windows, but then i found out that true modal windows cannot communicate with parent window in IE. Now i am trying to implement them as regular windows that always steal focus, which is sorta working. Here is the code tha...

How to write onshow event using javascript/jquery?

I have an anchor tag on my page, i want an event attached to it, which will fire when the display of this element change. How can i write this event? and catch whenever the display of this element change? ...

Possible to parse a HTML document and build a DOM tree(java)

Is it possible and what tools could be used to parse an html document as a string or from a file and then to construct a DOM tree so that a developer can walk the tree through some API. For example: DomRoot = parse("myhtml.html"); for (tags : DomRoot) { } Note: this is a HTML document not XHtml. ...

search and replace DOM elements in Java

I'm looking for a way to write a search and replace method using W3C DOM to update a tree. I've thought about doing a breadth-first search as below, but can't think of how to do the in place replacement? import org.w3c.dom.Node; private Element tree; public void searchReplace(Node x, Node y){ Queue<Node> q = new LinkedList<Node>(...

Testing Javascript that Manipulates the DOM

I've been looking into javascript test suites and I have found QUnit to be very interesting. I understand how to test computational code, but... How do you test javascript applications written primarily for DOM manipulation? it seems like testing the position/color/etc of DOM elements would be a moot point because you'd end up doing so...

IE8 JavaScript: select.options behaviour

I've today discovered some strange behaviour in IE8's implementation of the DOM select element's JavaScript 'options' property. Given the following HTML: <select id="sel"><option value="val">An option</option></select> And the javascript: var sel = document.getElementById('sel'); alert(sel === sel.options); //alerts 'true' in IE8 ...

Move HTML Canvas by javascript

Hi! I'm trying to copy element from one in my page to another (via javascript). It's successfully copied but appeared empty. How to copy/move canvas with content? ...

In JavaScript, how can I replace text in an HTML page without affecting the tags?

I'm trying to figure out how to do a replace with Javascript. I'm looking at the entire body of the page and would like to replace the keyword matches NOT within an HTML tag. Here is an example: <body> <span id="keyword">blah</span> <div> blah blah keyword blah<br /> whatever keyword whatever </div> </body> <script type...