dom

Replace only text on a webpage to create a link

Hello, I would like to modify text in a document that is in the form of a date and replace it with a link to add an event on that date to Google Calendar. I mostly have this working with one caveat, it tries to add the link inside of already existing links that have dates in them. document.body.innerHTML = document.body.innerHTML.repla...

See dynamicly generated DOM and CSS

This address is has a console javascript that i build with a custom jquery plugin. I wan't to extract the exact DOM and CSS after i fill some commands into it. Since the CSS and the DOM is generated at Runtime, i'm unable to get it. So my question is, how can i see this DOM and CSS that is generated at runtime? Thank you very much. ...

How to implement a generic DOM data structure in C++?

I'm trying to write a very simple implementation of Document Object Model library in order to provide a generic data structure to use in my further projects. Just to keep things simple I defined only three main classes: node, element and attribute. A node is defined by it's name (e.g. all html tags) and basically is a container for an el...

Extend Forms with Javascript

http://www.quirksmode.org/dom/domform.html I was reading through the site as mentioned above and tried to implement it in my project. But it just doesn't work when i click on "get me more fields" button. Here is the code: <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//...

Possible to create custom "DOMs" by loading HTML from string in Javascript?

I'm trying to parse HTML in the browser. The browser receives 2 HTML files as strings, eg. HTML1 and HTML2. I now need to parse these "documents" just as one would parse the current document. This is why I was wondering if it is possible to create custom documents based on these HTML strings (these strings are provided by the server or...

Any diffrence between element.setAttribute element['attr'] element.attr

I notice that javascript have several way to set and get attribute with an element. I am not sure is there any diffrence between them. especially, is there cross browser problems. ...

How to get computed style of a HTMLElement

no jQuery. pure javascript. e.g. Use element.height but I got nothing. I ever seen code like below befow: (ele.style || ele)[styleName] but I forgot what it use to. ...

issues with 'this' when using within jquery code block

I want to use values of the calling object within the jquery code block, but 'this' is mapped to the jquery object and not eh caller! How to solve this PLEASE? // class myClass = function (){ // member object this._localVars = { _elementClass:'.elem-class', _dots:null, _dotStatus:null }; // membe...

Remove all child elements of a DOM node in JavaScript?

How would I go about removing all of the child elements of a DOM node in JavaScript? Say I have the following (ugly) HTML: <p id="foo"> <span>hello</span> <div>world</div> </p> And I grab the node I want like so: var myNode = document.getElementById("foo"); How could I remove the children of foo so that just <p id="foo"></...

clicking on div fires binding for $('body').click

I have a div, I want to set it so that when I click on something else, it would hide the div. So I did $('body').click(function(){ if(loginOpened) { $('#loginWindow').animate({ 'width':'0px', 'height':'0px' },"fast"); } loginOpened=false; }); However, even when I click in the ...

YUI Get class name by id

Is there a syntax for getting the class name by id. The class name is dynamic so I can't use if(Dom.hasClass('id-name-here', 'class-name-here') { Dom.removeClass('id-name-here', 'class-name-here'); Dom.addClass('id-name-here', 'class-name-here'); } I can get the src attribute using the id by doing this, Dom.get('id-name-here').sr...

PHP DOM createElement - allow spaces

Hi, How to use spaces in createElement while creating xml file I have to use $main = $doc->createElement("$cname"."Data" ); where $cname="Company Name" But due to spaces in $cname, I am getting the following error, Fatal error: Uncaught exception 'DOMException' with message 'Invalid Character Error' in file.php:50 Stack...

Catch first and last <li> inside php variable

echo $ul; // gives this code: <ul id="menu"> <li id="some_id" class="some_class">...</li> <li id="some_id" class="some_class">...</li> <li id="some_id" class="some_class">...</li> </ul> How to add some class for the first and the last <li>? Need a regex solution. echo $ul; should give (if we add class my_class for the last <li>): <...

internet explorer print

How can I print a single dom element (such as table) or whole window dom object using java script in internet explorer, ff etc...? ...

Why jQuery.val( value ) does not dispatch any event from the DOM element?

When we use the method jQuery.Val( value ) over a DOM element to change its value. shouldn't the element dispatch an event informing that its value has changed? -I though the event 'change' was going to be dispatched. If it shouldn't why? Live Demo ...

How do I use the DOM to modify this?

How do I modify the style of the li element using DOM? <div id="tabbed-boosts"> <ul> <li>test1</li> <li>test2</li> <li>test3</li> </ul> </div> getElementById('tabbed-boosts').childNodes will get me to the UL, how do I modify the LI? Also needs to work in IE6... ...

Trouble hiding/showing divs in using DOM/js/css

I am trying to make a debugger that will be dynamiaclly created with some variables. The names on the left div need to show a div for the corresponding variables Description,Variable ID, and initial Value as well as another div that will show history and lock status when variables are updated later. Where I am having trouble is properl...

Which is the best client-side include technique ?

The ones I know: <iframe> <object type="text/html"> jQuery load XSLT (if available) ...

Can I move a Flash object within the DOM without it reloading?

I'm trying to use the scale effect from the jQuery UI library on a wrapper element that contains a Flash object. The problem I'm encountering is that the content of my wrapper is automatically moved into another wrapper (.ui-effects-wrapper), and when this happens the Flash object reloads. Of course, the specific problem here has to do...

How to build accordian style debugger with DOM - a nudge?

I have given up doing this in pure js. And I can't find the jquery accordian stuff i was looking over when I started this project originally. What is the best way to do this? My code is linked here ...