dom

DOM class injection in PHP

idea Via jQuery, I was able to mark all :first-child and :last-child elements in document (well, almost all :)) with class first which could I later style (i.e. first li in ul#navigation would be easily adressable as ul#navigation .first). I used following code: var $f = $('*:first-child') $f.addClass('first'); var $l = $('b...

How can I have a mouseover/in one off check?

Hi all, How can I test if a mouse is within a given div? I know how to use events to do something when it occurs but is it possible to check it on pageload only? What I want to do is smething like: if(mouse is in specified div) { check = true; } else { check = false; } Thanks, Denis ...

Best Practice: Access form elements by HTML id or name attribute?

As any seasoned JavaScript developer knows, there are many (too many) ways to do the same thing. For example, say you have a text field as follows: <form name="myForm"> <input type="text" name="foo" id="foo" /> There are many way to access this in JavaScript: [1] document.forms[0].elements[0]; [2] document.myForm.foo; [3] d...

Best Practice: Accessing radio button group

Looking for the best, standards compliant, cross browser compatible, forwards compatible way to access a group of radio buttons in the DOM (this is closely related to my other most recent post...), without the use of any external libraries. <input type="radio" value="1" name="myRadios" />One<br /> <input type="radio" value="2" name="myR...

Properties and methods array JavaScript

Hello everyone !!! I am trying to write DOM viewer on JavaScript. How I can get all properties and methods of some element? When I used "attributes" array I am able to get only properties that has set before. Thanks, Anton ...

add element to the DOM with JS

I want add element with JS. I have code: var collection = document.getElementsByTagName('body'); var a = document.createElement('div'); a.innerHTML = 'some text'; collection.item(0).firstChild.appendChild(a); and simple HTML: <html> <head> </head> <body> </body> </html> Where is mistake? ...

help with DOMDocument class in php

here is my xml DOM. <entities> <entity id="7006276"> <title>xxx</title> <entities> <entity id="7877579"> <title>xxx</title> <entities> i want to get the 'entity' with id 7006276 so i could access its child 'entities' t...

[DOM/JS] display table in IE

I have code like that: var xPola = 10, //how many cols yPola = 10, //how many cols bokPola = 30, //size of cell body = document.getElementsByTagName('body')[0]; var tablica = document.createElement('table'); body.appendChild(tablica); for( var y = 0; y < yPola; y++ ) { var rzad = document.createElement('tr'); tabl...

jQuery DOM manipulation

I have different php output in jQuery-based tabs. This output is formed from database and it consists of several <div>'s. Every time I click any tab it sends AJAX request to the php script which performs "SELECT" request and gives result back as response to AJAX request from the tab. $(document).ready(function() { $('ul.tabs li')....

Using jQuery, how can I obtain form data from fields that have been added by manipulating the DOM?

I have a table body that grabs it's rows (and form fields) via AJAX on various events. Everything is working fine, except one part: I can't obtain form data from any of the table's rows after it gets manipulated. I've played around with the live() function, but I can't seem to get the right setup to pull in the form data. Any ideas? ...

Getting iframe content with $() (update: In mootools)?

how do i minify this in mootools. window.frames['buffer'].document.body.innerHTML in mootools, this does not work: $('buffer').$('body').get('html'); OR $('buffer').get('html') ...

Looking for a C# code parser

I'm looking for a set of classes (preferably in the .net framework) that will parse C# code and return a list of functions with parameters, classes with their methods, properties etc. Ideally it would provide all that's needed to build my own intellisense. I have a feeling something like this should be in the .net framework, given all ...

In DOM is it OK to use .notation for getting/setting attributes?

Hi In DOM, is it OK to refer to an element's attributes like this: var universe = document.getElementById('universe'); universe.origin = 'big_bang'; universe.creator = null; universe.style.deterministic = true; ? My deep respect for objects and their privacy, and my sense that things might go terribly wrong if I am not careful,...

What's the best way to find the first common parent of two DOM nodes in javascript?

My question is exactly that but in context I want to examine the selection object, compare the anchorNode and focusNode and if they are different then find the first common parent element. var selected = window.getSelection(); var anchor = selection.anchorNode; var focus = selection.focusNode; if ( anchor != focus ) { // find common...

HTML DOM remove label

Hi, I have a label like <label for="Some Feild" >Some Text </label> Now I want to set the style of display of this label to none How can I do this ? ...

how to insert a SAML Assertion to SOAPHeader

NB-6.8 jdk-1.6.14 WSS4j-1.5.8 ,OpenSAML-2.3.0 I try to modify WSS4J-1.5.8 to operate SAML 2.0, and I could not insert a generated assertion to existing SOAP Header, the code like this: Assertion assertion = createAssertion("some subject", "some issuer"); Document doc = docBuilder.parse("request.xml"); Element parent = doc.getD...

Most efficient method of detecting/monitoring DOM changes?

I need an efficient mechanism for detecting changes to the DOM. Preferably cross-browser, but if there's any efficient means which are not cross browser, I can implement these with a fail-safe cross browser method. In particular, I need to detect changes that would affect the text on a page, so any new, removed or modified elements, or ...

Is there anyway to fade between background images in jQuery?

So I have an interesting image setup and I was wondering if it's possible to fade between two background images. I would assume if there was one, it'd be with multiple background images and opacities... hmm! ...

Lookup element by id within a DIV not injected in DOM

I have a DOM element in memory that is yet to be injected in the page DOM. I want to lookup an element by id inside this DOM element but document.getElementById wont work as the element is not yet in the page DOM. Any ideas on how to do this? P.S. I know one approach is to use element.querySelector() but since IE7 doesnt support it,...

change image use javascript DOM

<html> <head> <script type="text/javascript"> var curimage = "cottage_small.jpg"; var curtext = "View large image"; function changeSrc() { if (curtext == "View large image"||curimage == "cottage_small.jpg") { document.getElementById("boldStuff").innerHTML = "View small image"; curtext="View small image"; ...