dom

HTML DOM Validator - PHP or JavaScript

Hello, I am posting a form with a textarea in it. I allow HTML to be posted. Now I wish to check if the user has closed the tags he has put in the html he posted... when I am displaying that HTML, the broken tags like divs and tables etc spoil the whole page display... any way to check for proper tag useage in php or javascript ? Any...

jQuery event processing and the ready function

Hi, I am very new to jQuery (I started this morning) and I am confused about exactly what triggers the function supplied to the ready function, to be executed. According to the jQuery documentation [http://docs.jquery.com/Events/ready#fn%5D the ready function Binds a function to be executed whenever the DOM is ready to be trave...

Javascript DOM and dropdowns

I've got a dropdown that's code is as follows: <select name="month" onchange="updateURL()"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> ... <option value="12">December</option> </select> As you can see, when it changes, it calls the javascript function: updateURL()....

Make sure a range object doesn't start or end in the middle of a word

My application requires heavy use of ranges (https://developer.mozilla.org/en/DOM/range). In particular, users frequently highlight text and then manipulate it. Sometimes users accidentally highlight text that includes a fragment of a word, and this produces weird results. I'd like to be able to, given a range, check to see whether it s...

how is the DOM constructed in the browser (IE or FF) or how javascript traps object hierarchy

Would some please send me the link for any articles , which explains , how DOM is constructed in the browser after the response is received from server ...

JQuery DOM manipulation and window.onbeforeunload in Internet Explorer

Hi, I have this code block: window.onbeforeunload = function(){ <% if (Session["DisableExitConfirmation"] == null || !(bool)Session["DisableExitConfirmation"]) { %> if (isDirty) return '<%= Html.EncodeJsString(Html.Resource("profile_unsavedchanges")) %>'; <% } else { %> if (isDirt...

Can javascript listen for "onDomChange" on every Dom elements?

My question is somewhat weird, but can i add events for any DOM elements(div), like 'onHtmlChange', to be notified when that div has changed their content? ...

HTML to DOM Library

I am looking for a C# library that would translate the HTML code (and the css specified in the code) into a DOM tree for simpler parsing. I am looking for something similar to this one (which is in PHP): http://simplehtmldom.sourceforge.net/ Of course I know I could embed a browser control, but I am looking for something more efficient....

Issues retrieving selected text from IE browser

I'm creating a IE browser plug-in that needs to be kept updated about what text has been selected by the user, or if no text is currently selected at all. I learned how to get the selected text by reading here. This is my code for doing so: var doc = browser.Document as IHTMLDocument2; var selection = doc.selection as IHTMLSelectionO...

Use selectNodes with multiple alternative paths OR combine 2-3 IXMLDOMNODELIST

Hi, Just wondering if anyone would be able to help with the following VBScript script I'm writing: Can I do somthing similar to this: Set obj = something.selectNodes(path1, path2, path3) // Where it will match either of the paths? Or, if not, is there a way I can combine what selectNodes returns (IXMLDOMNodeList)? e.g. Set obj1 = s...

prototype recursive $

I'm using prototype and have some divs with id p1 p2 p3... In these divs I have some divs with id d1 d2 d3... I would like to use $ to get the specified d element, in the specified p element. If I'm given the values 3 and 4 I should be able to go $('p3').$('d4') This syntax doesn't work of course. There's an easy way to do this with ...

How can I mirror text selection?

Say you have two inputs: <input id="input1" type="text"/> and <input id="input2" type="text"/> such that through some JavaScript magic, anything you type in input1 will also be put in input2. In this sense input2 "mirrors" input1. Is there a way that I can also "mirror" text selection. So if I select some text in input1, how can I hav...

What is the most performant way to inject new code into the DOM?

Hi. I am engaged in a small debate with the server side developer for my project (I'm the front end guy) around injecting new stuff into DOM. He maintains that the best method to inject a large amount of code (received via ajax) is to send a JSON object and then to iterate through each item of that object. He says that will save some ba...

jQuery and Prototype events

I have a Prototype code that is triggered upon 'load' event: Event.observe($(imageEl), 'load', this.someFunction.bind(this)); When I create 'Real' event using jQuery code like jQuery(...imageEl selector...).attr("src", filename); it fires the Prototype code (someFunction). Good! Next I try to fire the Prototype code using jQue...

Why are IE and Firefox returning different overflow dimensions for a div?

I have a div with a fixed size of 100px. scrollWidth and scrollHeight works fine if the text in the div is normal (no word is long enough to fill the one row entirely). However, if there is any text with one word rendering wider than the 100px it will cause a problem. Let's say the text is like "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890": t...

how to create XPATH for a HTML DOM element?

Hi All, How to create XPATH for a HTML DOM element? for example, "/HTML/BODY/DIV[1]/TABLE[1]/TR[2]/TD[1]/INPUT". Given an DOM element how to get this XPATH string? Any ideas? Thanks, Dattebayo. ...

Silverlight app in iframe access to parent window

Hi, I have Silverlight application test page named A.html hosted in an iframe which is an element of B.html, so is there a way for Silverlight app to access elements in B.html by referring something like HtmlPage.Document..? Thanks! ...

How can I get the DOM element which contains the current selection?

You can select a part of a web page with the mouse. I know that I can get the currently selected text but how can I get the DOM element which contains the start or end of the current selection? ...

Is there a way to view the source of a web page AFTER all jquery scripts have run?

I currently use Chrome/Firefox for my web development. Is there a plugin, or am I just another way, where you can view the HTML source AFTER all jQuery plug-ins have run? I just want to see what and how jQuery modified the HTML? ...

HTML Validator in Javascript/PHP? ( not necessarily XML )

I'm looking for something like http://validator.nu/, I'll be validating html input ( string ) and I want to notify the user if there are any missing end tags, whether a certain element can't have a certain attribute, things of that nature ( HTML 4.01 Strict validation basically ). Sidenote: I won't be dealing with XML/DTDs, and I don't ...