I'd like to write a function (ideally in PHP) where I can input a url and return a string corresponding to the hypertext from that webpage which would render the largest in a browser (any standard browser is fine).
Getting the webpage and tokenizing things with DOM is pretty straightforward, but what's the best way to calculate ultimate...
I select some text on the html page(opened in firefox) using mouse,and using javascript functions, i create/get the rangeobject corresponding to the selected text.
userSelection =window.getSelection();
var rangeObject = getRangeObject(userSelection);
Now i want to highlight all the text which comes under the rangeobject.I am doing...
my PHP code
$dom = new DOMDocument();
@$dom->loadHTML($file);
$xpath = new DOMXPath($dom);
$tags = $xpath->query('//div[@class="text"]');
foreach ($tags as $tag) {
echo $tag->textContent;
}
what i'm trying to do here is to get the content of the div that has class 'text' but the problem when i loop and echo the results i only ge...
I might just be using the wrong keywords on Google, but what I have in mind is:
--------------------------------
| What is your mailbox? |
| |
| [ ]@mail.example.org |
| |
| [OK] [Cancel] |
--------------------------------
The idea bein...
I'm familiar with the DOMDocument::importNode method for importing a tree of nodes from some other document element.
However, what I was wondering is if I can automatically change the namespace prefix on a tree of nodes as I import them, that is, specify a new prefix for all nodes of that namespace.
Say the nodes, in their existing doc...
I've got a script that inserts some content into an element using innerHTML.
The content could for example be:
<script type="text/javascript">alert('test');</script>
<strong>test</strong>
Problem is that the code inside the <script> tag doesn't get executed.
I googled it a bit but there were no apparent solutions. If I inserted the c...
I'm writing a simple Greasemonkey script to strip out all the images, headings and paragraphs from a web page (it's because someone wants to use images of several popular websites with the images and text removed in a presentation about branding of websites). I've figured out how to do so with images by using a for loop and the document....
Hi, this code in my plugin used to work just fine:
jQuery('#embedded_obj', context).get(0).getVersion();
and the html...
<object id="embedded_obj" type="application/x-versionchecker-1.0.0.1"></object>
Basically trying to get the properties from an embedded object. But it looks like get(0) is returning an html object instead of th...
Hello folks,
Upon user interaction, I need to remove certain input params from an HTML form before submission. Using javascript to remove the input fields from the DOM doesn't seem to actually remove the params from being sent through the request.
Is there a way to delete or clear the actual request params?
...
Is there any way to modify an html page hosting a Silverlight page using the embedded Silverlight application? I already know how to access existing html elements, but I'm not sure how to add and remove elements dynamically. Thanks in advance.
...
For example if I assign
var n = document.getElementById('A').childNodes.length;
And then later append a child to A, would n update itself or would I have to assign it the new length again?
...
Hello everyone! Is it possible to load an html document into a DOM javascript object so that you can read the elements in the document? For example, if I have a file on the server Test.html. Can the page Hello.html call javascript code to load Test.html into a DOM object?
Please let me know.
Thanks
...
I have two div elements that are twins (i.e. their dimensions and contents are identical). I want to move of those div-s over another, so that their corners are at exactly the same coordinates. What I try to do is:
var offset = $('div#placeholder').offset();
$('div#overlay').css('position', 'absolute').css('left', offset.left + 'px').cs...
It bugs me that I can't just do document.querySelectorAll(...).map(...) even in Firefox 3.6, and I still can't find an answer, so I thought I'd cross-post on SO the question from this blog:
http://blowery.org/2008/08/29/yay-for-queryselectorall-boo-for-staticnodelist/
Does anyone know of a technical reason why you don't get an Array? ...
I am trying to re-arrange all the attributes of the XML file.
Need to group all the attributes of each node.
<?xml version="1.0" encoding="UTF-8"?>
<subject>
<param name="A" value="a" />
<study>
<param name="AA" value="aa" />
<series>
<param name="AAA" value="aaa" />
<dataset>
...
Hi,
I am looking to scroll the page to a particular location.Something like this:
function scrollTo(y){
document.body. some-property = y;
}
I am looking to solve this without using any libraries.
I know scrollTop works in some browsers but I tried it if FF 3.6 and IE 8 and it doesn't work.
Does anyone know how to complete that fu...
var accordion = document.createTextNode(tp.getAccordionContent());
var el = document.createElement("div");
el.appendChild(accordion);
document.getElementById("gp").appendChild(el);
tp.getAccordion() function returns me a string like < div .... and it is being decoded. All I want is to get it encoded and implement the di...
I have a table of frequently updated information. This is presented using a container div with a div for each row, each row containing 10 divs.
I am using setInterval to call a an asmx webservice that returns some json formatted information.
On the success callback I call $("#myContainer").empty(); on the container div and recreate the...
I've this xml
<root>
<node1>
<node2>xxx</node2>
</node1>
...
<node1>
<node2>yyy ABC yyy</node2>
</node1>
...
<node1>
<node2>zzz</node2>
</node1>
</root>
I want to get node1 that has a node2 containing the text ABC.
Is it possible to achieve this using XPath?
...
Breakpoints are great when one knows where the code is being executed. However, I have a problem where my DIV is being manipulated by some unknown code in a library I'm using. Is there a way to basically set a breakpoint on the node and see when children are added or attributes changed?
...