dom

Detecting the exact moment an element appears in the DOM

Is it possible to detect the exact moment an element exists in the DOM on page load? Context: On page load i hide an element of my page using jQuery (i.e. If JavaScript is available i want to hide the div) but on poor internet connection you see the panel for a second or so before it disappears. I'd like to hide the element as soon as ...

How performance-hungry are events in Prototype (JavaScript)?

Does anyone know if using custom events in Prototype (using Element.fire and Element.observe ) affects performance? Also would I gain performance if I use global variables instead of events? Thanks! ...

javascript and element location

Hi, I want to get up to speed on element location and javascript. ie. if someone clicks on an element, I can show a menu just below that element. Now I realize I have to account for the fact that if someone clicks on a element to the extreme left/right or bottom of the page, I have to know if the menu is visible on the screen properly...

How to debug java depenendency failure on version of DOMImplementation

I've a chunk of code that works fine in isolation, but used a dependency in a clients project fails. A call to Document doc = impl.createDocument(null,null,null); fails (looks like the problem at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4913257). The instance of 'impl' in my unit tests is an instance of com.sun.org.apache.x...

Hide a datagrid column with Javascript?

I have a .net datagrid with some 20 columns. I need a column's visibilty to be toggled based on the click of a button using javascript. Any ideas? ...

How to get height of the highest children element in javascript/jQuery?

Hi, I need a function to get the height of the highest element inside a div. I have an element with many others inside (dynamically generated), and when I ask for the height of the container element using $(elem).height(), I get a smaller height than some of the contents inside it. Some of the elements inside are images that are bigge...

Setting a cookie value to a incrementing int

Is there a integer element for a cookie? I need the cookie to increment by 10 everytime a certain button is pushed. How can I start the cookie at 0 the first time and it's next value is based on it's current state. document.cookie += 10; gives 10, then 1010, then 101010. Right I dea but I need integer values- Need 10, 20, 30, etc... ...

What characters are allowed in DOM IDs?

Underscores seem fine. What about dashes? Other special characters? ...

Javascript memory leaks after unloading a web page.

I have been reading up to try to make sense of memory leaks in browsers, esp. IE. I understand that the leaks are caused by a mismatch in garbage collection algorithms between the Javascript engine and the DOM object tree, and will persist past. What I don't understand is why (according to some statements in the articles I'm reading) the...

Jquery - .next() with children of many parents

I'm writing a script to highlight table cells across multiple tables, in a calendar. The days to be highlighted have the class "available". This is the jQuery code currently: $(document).ready(function(){ $("td.available").mouseenter(function() { $(this).addClass("highlight"); $(this).next().addClass("highlight"); }); $("td.available"...

How do I view the HTML Dom afer a jQuery modification?

I am using DebugBar in IE to view the DOM. But after I modify the DOM with jQuery I can not see the new or modified DOM with DebugBar. How Do I view the modified DOM? ...

What XPath selects odd TRs from a table, starting with the third?

I have a table: <table> <tr><td>1</td></tr> <tr><td>2</td></tr> <tr><td>3</td></tr> <tr><td>4</td></tr> <tr><td>5</td></tr> <tr><td>6</td></tr> <tr><td>7</td></tr> <tr><td>8</td></tr> <tr><td>9</td></tr> </table> I need an XPath to select odd rows, starting on the third row (3, 5, 7, 9, etc.). ...

Javascript - Get child's text value

How can I get the text value from an elements's child? Say I have this code on a page: <div class='geshitop'> &#91; CODE &#93; &#91; <a href="#" onclick="javascript:copy(); return false;">PLAIN-TEXT</a> &#93; </div> <div class='geshimain'> <pre><div class="text" style="font-family:monospace;">Code goes here...</div></pre> </div> ...

Transforming Results of PostgreSQL Query to XML, using PHP DOM

Hey everyone, Given SQL as an input, I have to query a PostgreSQL database and return the results as XML. I have done this with the following code: <?php $link = "host=localhost dbname=company user=pgsql password=password"; $connect = pg_connect($link); $query = "SELECT * FROM customer"; $result = pg_query($connect, $query); $doc =...

Javascript function results in HTML page reload: why?

Hi all, Newbie question... The objective: I intend to have an HTML text input field as a kind of command line input. An unordered HTML list shows the 5 most recent commands. Clicking on one of the last commands in this list should populate the command line input text field with the respective command (in order to re-execute or modify...

Accessing the JavaScript Table DOM in a Java Servlet

I want to write reusable code that takes an HTML table from a JSP and converts it to Excel format to be exported to the user. I want to take advantage of the HTML DOM Table Object rather than parse the HTML in Java to extract the same information. The biggest advantage to this would be inspecting each cell for checkboxes, buttons, etc....

C# Web Browser with click and highlight

Before I go off and code this, I thought I'd see if anyone here knows of any open source (or paid for) equivalents already built. I'm looking for a browser control where users can preview a web page and then highlight elements of it and once highlighted, I can get the div or id of the element selected. Has anyone seen such a thing? ...

detect div content changes with jquery

change() function works and detects changes on form elements, but can I have a way of detecting when a html content was changed? This is not working, unless #content is an input fields $("#content").change( function(){ // do something }); I want this to trigger when doing something like: $("#content").html('something'); Also h...

Javascript syntax used in hiding html column

I am looking at code that toggles displaying and hiding a table column. I am assuming this creates an array: var States = { }; Why no need for the new operator? Does this line set the States col element .isOpen property to true? States[col] = {isOpen : true}; I am figuring out how to modify this function so I can save the state...

How to access Firefox's DOM (or HTML content) from outside firefox.

Hi guys! I have a question: My program will search FireFox windows opened by user. When a user open Firefox and enter any site, I want to search for a keyword in that page's HTML content. How can I access Firefox's Active Tab's DOM (or HTML content) from outside firefox using my C++ program. Is it possible? If so, can you give me som...