dom

How can I embed a Java applet dynamically with Javascript?

I want to be able to insert a Java applet into a web page dynamically using a Javascript function that is called when a button is pressed. (Loading the applet on page load slows things down too much, freezes the browser, etc...) I am using the following code, which works seamlessly in FF, but fails without error messages in IE8, Safari...

What are the benefits of using sessionStorage?

Just wondering what are the actual benefits of using HTML5's sessionStorage when storing HTML content to be used in a Javascript carousel? Is it performance related? Load Times? Bandwidth? ...

Select Element By CSS style (all with given style)

Is there a way to select all elements that have a given style using JavaScript? Eg, I want all absolutely positioned elements on a page. I would assume it is easier to find elements by style where the style is explicitly declared: the style is non-inherited (such as positioning) the style is not the default (as would be position:sta...

Good practice method for loading JavaScript via ajax

Disclaimer: I'm fairly new to AJAX! I've looked around, and I'm not sure which method to use to load javascript using ajax. I'm using ajax to request pages that each require their own 6-10 short methods. In total there will be maybe 5-6 of these pages, so an approximate total of 35+ methods. I would prefer to access necessary javascri...

How to get request uri from location.href in javascript?

What I get from location.href is like this: http://stackoverflow.com/questions/ask But I only want to get questions/ask (no / at the first character) How to achieve this? ...

PHP DOM problem searching for <w:t> tags in XML

So I have an XML file (XML export of a MS Word file). What I am just trying to do is to replace these two lines: <w:t>Meno:</w:t> And: <w:t>Priezvisko:</w:t> This is a longer XML excerpt: <w:p w:rsidR="00CF175F" w:rsidRDefault="00CF175F"> − <w:r> <w:t>Meno:</w:t> </w:r> </w:p> − <w:p w:rsidR="00CF175F" w:rsidRDefault="00CF175F"> −...

PHP DOMElement getElementsByTagName specific selector

$content = file_get_contents(http://www.domain.com/page.html); $dom = new DOMDocument(); if (!@$dom->loadHTML($content)) die ("Couldn't load file?"); $title = $dom->getElementById("cssid"); $data['heading'] = $title->nodeValue; // this works fine I would like to be able to select all p tags that are within a certain id. With Jquery ...

How to append a line of JavaScript (rather than an exteral .js file)?

I want to append a script tag which executes one line of JavaScript to the head of a document, rather than appending a script tag which is empty and uses the src attribute. Here's what I've got so far: <script type="text/javascript"> var scriptContents = 'alert("hi")'; var theScript = document.createElement('script'); theScript.type ...

How to replace all empty <img src=""> on a page with JavaScript on dom loaded?

Hey everybody, I need a function, that starts, when the DOM is loaded. In my HTML Page are several empty Image Tags, like and I want to add an Image-Name into the src-property when everything is loaded to get something like <img src="blank.jpg">. Best wishes Chris ...

modifying xml document using php

hello everyone , i have an xml file "Machine.xml" it contains: <Parameter name="host" value="localhost"/> <Parameter name="port" value="5900"/> i would like to change both parameters values using a php script... how can i do that? i mean i want the script to change host's value for example to : value="7.3.4.5" and port value to...

How would you pick the best image from a webpage in a crawler?

If you were given any random webpage on the internet and had the html source only. What method would use to give you the most accurate image that would best describe that webpage? Assume that there are no meta tags or hints. Facebook does something similar when you post a link but they give you choices of n images to chose from, they d...

Javascript document.write weird behaviour in Firefox

Hi all, When I write the following code directly into my html page under a script tag, the string "test" gets appended to my page without replacing the rest of its content (1): document.write("test"); However, if I place that same code into a separate javascript file like (2): <script src="http://127.0.0.1/whatever.js" type="text/ja...

jQuery lightbox problem

I got two divs, one is a background and the other is the container for a vid which is on top of the former. Another div serves as a button that when clicked, it triggers the lightbox. Here's my code: //0 means disabled; 1 means enabled; var popupStatus = 0; var buttonDivID = ""; var conDivID = ""; //determine which div is clicked fun...

Firefox: Is there a way to suspend reflow during heavy DOM manipulations?

I need to do heavy DOM manipulations on the whole document of webpages in an Add-On I write. I would like to minimize the reflows so only one reflow happens for all my manipulations. Removing the body element, doing the manipulations and then inserting it again is not an option because this reevaluates all <script> elements. Currently I ...

Removing a hover effect from a revisited page with back button

I'm working on this website, and have a little thorn in my side. When I click a link in the sticky note on this page, then hit the back button, the link still appears to be hovered-over. What would be the least script-intensive way to prevent the link from thinking it's still being hovered over? The problem appears in Safari, Firefox, a...

How can I implement this interaction model with jQuery?

With jQuery, I'm interested in creating the following interaction model. When a user types in the page, anytime jQuery notices three !, "!!!" typed in a row, to be able to do something about it. After noticing three !, "!!!", wrap the previous sentence (finding the last period from the location the user is currently typing and wrapping...

Xerces-C++ DOM node line/column number location

Hi, I'm writing a custom XML validator using Xerces-C++. My current approach loads the document into a DOM, and then checks are performed on it. What I need is a way to access the line/column number of a node in the DOM. I've been reading the API docs and googling, but I'm coming up short. Is it possible to somehow retrieve this kind of...

Catching any click performed using jQuery

Hi folks, the noob way to do it I guess would be $('*').click(function(){...}); But is there any way I can catch any type of click, without having to register a listener for every object in the DOM? Help would be amazing. =) ...

javascript How to trigger native click action (replay event) later?

I'm using jQuery to bind to all links on the page (I'm using the 'click' event, but have tried various combinations of 'mousedown' and 'mouseup',together with bind() and live() to no avail). I can intercept the click no problem (with all the above methods). What I am trying to do is send some data via a GET request, and when it complete...

How to change form element values in HTML

Hi Guys, I have this piece of simple code. <html> <head> <script type="text/javascript"> function changeText() { var form = document.forms['detail']; form.desc.value="success"; } </script> </head> <body> <form name="detail"> <input type="text" name="desc" id="desc" > <input type="submit" value="c...