dom

How can I access the DOM using WebKit.NET?

I'm using WebKit in a C# application to render a CSS-styled XML document, and I'd like to be able to add DOM elements. How do I get access to the DOM to do this? The problem seems to be that there is no property in the WebKitBrowser class that gives access to the private webView member. Is it possible? Do I need to modify the class to ad...

Get element at specified position - JavaScript

Using Javascript how can I identify the element at a given position? Basically I'm looking to write a function that takes two input parameters (the x and y coordinates) and returns the html element at the position on the screen represented by the parameters. ...

modifying select with DOM

hey, I've found some results for this on google but nothing satisfying so I was hoping someone here might know. It seems as though populating a select element using innerHTML does not work in IE I have set up a file that does nothing but that and it works with everything but IE, here's the code in case anyone cares: <html> <head></hea...

Modifying the DOM based on an AJAX result with jQuery

I'm unsure of the best practice for modifying the DOM based on an ajax response. I'll try to let the code do the talking because it's hard to explain. // page has multiple checkboxes $("input[type='checkbox']").live('click', function { var cb = $(this); // for the sake of discussion i need this variable to be in scope $("form").ajax...

How to detect if an element is not visible in a fast way in JavaScript?

Hi! In the past we used the CSS attribute "display" to show and hide DOM elements. To check if an element is visible, we could just use: element.offsetWidth > 0 Since we had some problems with Flash and Java Applets (they stop when they get display:none) we switched to the CSS attribute "visibility". I am now looking for a fast and e...

document.getElementById (still) not working

I started a thread here http://stackoverflow.com/questions/1266470/document-getelementbyid-not-working but it looks as though even the suggestions made were valid I still have a problem. I have a couple of checkboxes. When i view the page source here there are. document.getElementById('chk1') is the only one that is not null. How could ...

CSS rule for attribute + sibling in DOM

What I have is a form with one fieldset containing several other fieldsets. For each fieldset, the user can check a box next to the legend and expand that fieldset (in theory, at least). I was thinking it would be cool to try using pure CSS for the effect, but I'm getting hung up on how to write the rule based on the two elements positi...

How do I tell DOMDocument->load() what encoding I want it to use?

I search for and process XML files from elsewhere, and need to transform them with some XSLTs. No problem. Using PHP5 and the DOM library, everything's a snap. Worked fine, up till now. Today, funky characters were in the XML file -- "smart" quotes from Word, it looks like. Anyways, DOMDocument->load complained about them, saying that th...

Jquery IE8 Dom manipulation fails to expand elements

Hi, I have a few areas in a form I'm producing where I use jquery to appendTo a dom element I have created and slide it down as follows: function createForm(event) { var input = $(event.data.element); var name = input.val(); input.attr("disabled", true); input.parent().parent().fadeOut("slow", function() { $.get('<%=Ur...

Changing node id by replacing the node

I am trying to polish off a nav menu by having a script that fetches the current page name (via $_SERVER["PHP_SELF"]) and then in JavaScript finds the relevant name (i.e. from /contact.php finds just contact) and searches for an element with that id (my list items have ids that match their target). Now I want to swap the id of the eleme...

Close multiple DIV elements with a jQuery function

Hi. I need a small function for jQuery that would close multiple DIV elements, but I'm having trouble with JS syntax. I got this far: function closePanels{ $("#servicesPanel").hide("fast"); $("#portfolioPanel").hide("fast"); $("#contactPanel").hide("fast"); $("#aboutPanel").hide("fast"); }; Sounds logical to me: That...

Invoking :hover pseudo-class by transferring events via JavaScript

Here is the scenario: You have two images and they are stacked on one another. The highest-order z-indexed image is responsible for handling click events (think Google's Map API) and is transparent, while the image below is responsible for a visual representation. Here is a pseudo-HTML/CSS representation: div.visual-container { wi...

Extracting link display text as well as href attribute with PHP 5

$oldSetting = libxml_use_internal_errors( true ); libxml_clear_errors(); I have seen many examples on the web on how to extract the URLs from HTML with PHP 5's DOM functions, but I need to get the link text as well as the link. If I use the code below to extract the link "http//X.com" from the "href" attribute in the anchor tag YYYYY, h...

Joining 2 XPath Queries

I'm having a hard time with XPath here.. Given the following XPath queries: $xpath->query('//input[@name="' . $field . '"]'); $xpath->query('//select[@name="' . $field . '"]'); Is is possible to combine them into one single query? I want to get the value of the field, however I don't know if the field with be a input, select, textarea...

DOMDocument & XPath - HTML Tag of each Node

Given the following PHP code using DOMDocument: $inputs = $xpath->query('//input | //select | //textarea', $form); if ($inputs->length > 0) { for ($j = 0; $j < $inputs->length; $j++) { $input = $inputs->item($j); $input->getAttribute('name'); // Returns the Attribute $input->getTag(); // How can I get the input,...

Convert String to XML Document in JavaScript

Saw this example on the jQuery examples page for Ajax: var xmlDocument = [create xml document]; $.ajax({ url: "page.php", processData: false, data: xmlDocument, success: someFunction }); How do I take a string like: var t = '<foo><bar>something</bar></foo>'; And convert that to a XML DOM object? cross-browser? UPDA...

Unpredictable hierarchy in JSON object...

When building an ajax application, I normally prefer fetching remote data in JSON format. However, when the hierarchy is unpredictable (specifically geocoding responses from Google Maps API), it is tempting to go with XML format because the DOM method getElementsByTagName will get the data wherever it is in the hierarchy. Assuming there ...

Determine Document Order from Nodes

If I have two nodes in an HTML document, how can I tell which one comes first in HTML document order in Javascript using DOM methods? For example, function funstuff(a, b) { //a and b can be any node in the DOM (text, element, etc) if(b comes before a in document order) { var t = b; b = a; a = t; } // process the...

OS X 10.5 SDK deprecated getAttributeNS; what should I use instead?

I'm upgrading a project to use the 10.5 SDK. I'm getting warnings of this form: warning: 'getAttributeNS::' is deprecated (declared at /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/WebKit.framework/Headers/DOMElement.h:74) ...for getAttributeNS, hasAttributeNS, removeAttributeNS, replaceChild, and getElementsByTagNa...

Java XML parsing using DOM to get nodevalue

try { String data = "<a><b c='d' e='f'>0.15</b></a>"; DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); InputSource is = new InputSource(); is.set...