dom

Sprite background image lags on mouse hover

I have basic DOM menu that has sprite background images for the first level of "LI"s. It works just fine, but I guess there is some problem and instead of switching the image right away on hover it goes blank and after about a second the hover image "appears" (shifts). That happens only on first hovering. After that it's smooth like it'...

Insert into textarea | JavaScript

I'm trying to insert the image url where the point of the is to be when editing the textarea value. function addImageURL() { var imageurl = prompt("Enter image URL", "Your name") var post = document.getElementById("message-put").value; document.getElementById('message-put').value = post + '[img]' + imageurl + '[/img]'; } This code...

Making an SVG DOM JavaScript class

I'm unsatisfied with other JavaScript libraries and frameworks like jQuery, MooTools, and Raphael, because of their inability to support SVG grouping. You'd think it'd be a very simple thing for them to implement. Anyway, I'm trying to make a JavaScript class (using John Resig's class.js script) like this: var El = Class.extend({ e...

After I appendChild() in ie6, do stylesheets apply to that element?

I am creating some elements in javascript like so: var parent = document.createElement('div'); parent.setAttribute('id', 'parent'); var child = document.createElement('div'); child.setAttribute('class', 'child'); parent.appendChild(child); otherelement.appendChild(parent); I have a stylesheet which has styles for #parent and .child....

parsing html pages from tcl

Hello , I using tdom version 0.8.2 to parse html pages. From the help pages I found the following commands to get the ElementById TCL code set html {<html> <head> </head> <body> <div id="m"> </div> </body> </html> } package require tdom set doc [ dom parse -html $html ] set node [ $doc getElementById m] But when I execute the s...

How can I find a text node in the live DOM using its copy/clone?

I've copied some text nodes from the page (i.e., live DOM) and have stored them in an array. Is it possible to locate those exact nodes again in the live DOM? I would need to use plain JavaScript. This is basically how my project works: A configuration object specifies sections of the page (using CSS selectors) where there is some tex...

Validating output from one or more document.write

I have a form that accepts javascript which allows the use of document.write() and I want to validate the output of the javascript which may look like this: var a = 'book1'; var b = 2; document.write("</scr"+"ipt>"); document.write("<scr"+"ipt type='text/javascript'src='http://www.example.com/loader.js?mydoc="+a+"&amp;page="+b+"'&gt;")...

how many div's can you have before the dom slows and becomes unstable?

I am developing a jQtouch app and each request done via ajax creates a new div in the document for the loaded content. Only a single div is shown at any one time. How many div's can I have before the app starts getting unresponsive and slow? Anyone have any ideas on this? EDIT: Its an iPad app running on Safari, and it would be less t...

Good Javascript (inc frameworks) and DOM books

I have recently been using jQuery and some modules of Yahoo's YUI tools to develop a website and found myself getting more interested in learning how the Javascript code works "behind the scenes". This Javascript book has been recommended to me, however I have heard that it isn't as suitable for beginners in the language - I am a fairly ...

Under what conditions can I access the HTML-DOM of a child IFrame from the hosting website?

What can cause my website to not have access to a child IFrame's DOM via Javascript? Are there cross-domain restrictions in place? Does HTTPS play a role? ...

Installing PHP DOM functions on Apache

I have just moved my code over to a new server (running on Apache 2.2.3), and PHP's DOM functions are now returning "Fatal error: Class 'DOMDocument' not found". I did some research and it appears that the installation I am now on does not have PHP's DOM functions enabled. I need to enable these functions, so what is the quickest way t...

How to find if a DOM element is attached with some Javascript or not?

For some testing purpose I want to traverse the DOM and want to find if that particular element is bound to some JS. I am using jQuery. I tried with $('selector').data() but with no avail. Can anyone please help me? ...

Sorting a google calendar feed (parsing with DOM)

I'm embedding dates from google calendar into a website, and it's all working, with the exception of sorting. For some reason, it sorts into reverse-chronological order, when I'd really just like it to be normal chronological (first event first). this is the output: August 11th: Intern depart August 6th: Last Day of Summer Camp July ...

How to disable firefox's form auto completion without change events?

So firefox has a nifty mechanism which will try to autocomplete values in fields when a page is reloaded or the back button is used. Which is great and all except when you have something like a drop-down which when set to a value modifies the page using ajax. What winds up happening is that the browser reloads the page, the drop down is...

Writing XML in different character encodings with Java

I am attempting to write an XML library file that can be read again into my program. The file writer code is as follows: XMLBuilder builder = new XMLBuilder(); Document doc = builder.build(bookList); DOMImplementation impl = doc.getImplementation(); DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0"); LSSe...

Getting HIERARCHY_REQUEST_ERR when using Javascript to recursively generate a nested list

I have a method that is trying to take in a list. This list can contain data and other lists. The end goal is to try to convert something like this ["a", "b", ["c", "d"]] into <ol> <li> <b>a</b> </li> <li> <b>b</b> </li> <ol> <li> <b>c</b> </li> <li> ...

How to insert an element between the two elements dynamically?

I am using a table, in which there are buttons, on button click i want the new TR element to be inserted between the two TR or at the end of the TR... my code goes here <table> <tbody> <tr> <td> <input type="submit" value="Add" onclick="addFunction()" /> </td> </tr> <tr> <td> <input type="submit...

Jquery bind doesnt work on AJAX loaded HTML

Hi, This is my jquery code jQuery(document).ready (function() { // post $('.post').bind('mouseenter mouseleave', function() { $(this).filter('.btn').toggleClass('hidden'); }); }); It works great on a normal document. but When I load some HTM: (i.e some divs with .post attributes) using ajax and embed it into my ...

How and when do browsers implement real-time changes to a document's DOM?

My website dynamically embeds an external Javascript file into the head tag. The external Javascript defines a global variable myString = "data". At what point does myString become accessible to Javascript within the website? <html> <head> <script type="text/javascript"> myString = null; external = document.createEle...

nicer way of handling dom than DOMCategory?

I'm trying to create a DSL that can easily use a dom node. Using DOMCategory is nice, but adds the noise of 'use(DOMCategory)'. Is there a way to avoid that? I tried wrapping the script call inside a call to 'use', but this doesn't seem to work in closures. ...