dom

jQuery, dynamic name change of radio button

Looking for something like: $("input:radio:checked").previous("name", "original_name").attr("name","new_name"); I tried a few different seen around here but mostly get the error: Object Expected Any help is appreciated. ...

What is DOM element?

What is the meaning of DOM element in the following statements? Statement #1 You can add multiple classes to a single DOM element. Statement #2 The -- point is that inheritance in CSS is done not through classes, but through element hierarchies. So to model inherited traits you need to apply them to different levels...

How to get the most current IHTMLDocument2 object from IE DOM

Currently, I use MSAA to get an IHTMLDocument2 object from a IE HWND. However, with some complicated web applications, this IHTMLDocument2 object may contain serveral IHTMLDocument2 objects, some of them are not belong to the current displaying page, but the previous page. It seems to me, IE sometimes doesn't refesh its DOM object, but...

PHP DomDocument selectors like jQuery.. does exist something like that?

Hi guys, im pretty new to the PHP DomDocument, im reading the documentation right now and im wondering is does exixts some selectors like the ones we seen in jquery. Well, i exmplain my situation: i have this xml file to parse every day and update a database: Europe Bank Money Currency That's a little snapshot: <gesmes:Envelope> ...

Access the Contents of a Web Page with C#

I am trying to use C# to access the content of a webpage. For example, I want to grab the text of the body of google homepage. I know this is doable in C# with its web browser control. But I couldn't find a good, simple example of doing it. All the resources I found online involve creating Forms and GUI, which I don't need, I just need...

Are image properties part of the DOM (jQuery - webkit inconsistency with other browsers)?

I ran into a problem on Chrome and Safari using jQuery to do some calculations using the widths of a strip of images. When using my calculations in: $(document).ready(function() { /* some calculations with $("img").width() */ }); everything works just fine in IE6+ and Firefox, but it does not in Chrome and Safari: $(img).width() ...

Using Jquery to wrap dynamic content with html tags

I have a page that returns a dynamic list of items <ul> <li>item1</li> <li>item2</li> <li>item3</li> <li>item4</li> <li>item5</li> <li>item6</li> </ul> I need a way to insert tags around every grouping of 3 list elements. Basically transform the code above into this <ul> <div> <li>item1</li> <li>item2</li> <li>item3</li> </d...

How to handle/parse ill-formed html into DOM in java?

I am using NekoHtml. It failed parsing html from sites like mercurynews.com into DOM. Any solution to the problem? ...

mshtml.HTMLDocumentClass in C#

In C#, I managed to get the entire HTMLDocumentClass from an InternetExplorer object (navigating to a certain URL). However, in Visual Studio 2008's debug mode, the content of this HTMLDocumentClass for this particular URL is MASSIVE, including attributes like activeElement, alinkColor, all, applets, charset, childNodes, etc, etc ,etc. ...

Accessing DOM elements in C#

I am using the mshtml namespace to access DOM elements as returned by a COM Browser object. My code is roughly as follows object missing = Type.Missing; ie.Navigate("http://website.com", ref missing, ref missing, ref missing, ref missing); mshtml.HTMLDocument theDoc = (mshtml.HTMLDocument)ie.Document; mshtml.HTMLDivElement myDiv = (msh...

How may I sort a list alphabetically using jQuery?

I'm a bit out of my depth here and I'm hoping this is actually possible. I'd like to be able to call a function that would sort all the items in my list alphabetically. I've been looking through the jQuery UI for sorting but that doesn't seem to be it. Any thoughts? ...

why does my checkbox always get unchecked?

The following code adds a checkbox and a label to the calling node. My question lies in the label.click function. Whenever the label is clicked I want to change the state of the matching checkbox. What happens however is that the checkbox always ends up unchecked. For debugging purposes I now always explicitly set it to checked. When I...

How to convert from parsing with Dom to parsing with SAX

I'm parsing an XML document into my own structure using DOM, but in another question I was advised to use SAX, how would I convert the following: public static DomTree<String> createTreeInstance(String path) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory docBuilderFactory = DocumentBuilde...

Does the ID's of DOM change from browser to browser?

In C#, I am using the mshtml.HTMLDocument to retrieve various elements from a page. For example: button = (mshtml.HTMLButtonElement)theDoc.getElementById("ID1"); Now, if I am running IE6,IE7,IE8, will "ID1" change depending on browser version? ...

Javascript CSS Woes - DOM Styling

Hey, I have the following as part of a script: // JSON object out into DOM Nodes, and appends them to 'searchResults' DIV) var amzJSONCallback = function(tmpData){ if(tmpData.Item){ var dv = cel('div'); var gDiv = getEl('searchResults'); gDiv.innerHTML=""; var tmpItem = tmpData.Item var ig = cel('img'); ig.setAttribute('s...

Hooking a GWT event onto an element in an external iframe

Hi everyone, I am writing a GWT app that involves interacting with an external document in an iframe. As a proof of concept, I am trying to attach a click handler to a button. The following works in javascript var iframe = document.getElementById("rawJSIFrame"); var doc = iframe.contentDocument; var body = doc.body; var button = doc.g...

Reading a file from Java Servlet

I wrote some code to read a file in my Java Servlet class. (I'm using Netbeans on Windows along with Tomcat server). However, my servlet cannot find the file! After much digging, I found that I had to place the file I wanted to read in Tomcat/bin folder. That's very surprising. How can I get the path to my Webapps/ folder? Let's assume ...

How to make XMLDOMDocument include the XML Declaration?

When an XMLDOMDocument saves itself, how can i get it to include the XML Declaration, e.g.: <?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-16" ?> <?xml version="1.0" encoding="UCS-2" ?> <?xml version="1.0" encoding="UCS-4" ?> <?xml version="1.0" encoding="ISO-10646-UCS-2" ?> <?xml version="1.0" encoding="UNIC...

How can I tell if a jQuery node is at the beginning of its parent node?

Given the following HTML: <p><img id="one" alt="at beginning, return true" />Some Text</p> <p>Some <img id="two" alt="in middle, return false" />Text</p> <p>Some Text<img id="three" alt="at end, return false" /></p> How would I be able to tell that $("img#one") is at the beginning of its parent node? Ideally what I'm trying to do is ...

What is the difference between the onFocus and onMouseEnter event?

What is the difference between the onFocus and onMouseEnter event? ...