dom

document object confusion

In one php file (file1.php), I execute another through <form action="file2.php" method="POST"> yet within file2, I want to access html elements from file1.php, via document.getElementById(). Yet, the document object is different for file1 and file2. How can I access file1's elements from within file2? ...

Detecting if a browser is in full screen mode

Is there any way of reliably detecting if a browser is running in full screen mode? I'm pretty sure there isn't any browser API I can query, but has anyone worked it out by inspecting and comparing certain height/width measurements exposed by the DOM? Even if it only works for certain browsers I'm interested in hearing about it. ...

How can jQuery show different items based on a variable

I want to create a navigation bar that cna be used on every page. Most nav items have the same styling, however the nav item that relates to the current page has differen tstyleing. I want to be able to use jQuery to read a meta tag and display the correct styling. I have pasted my code below - this doesn't seem to work: <!DOCTYPE htm...

Possible jQuery memory issues with $('#foo').remove() ?

I've just discovered that when the remove() function is used, the matched elements are not removed from the jQuery object, just the DOM. According to the remove() documentation: Removes all matched elements from the DOM. This does NOT remove them from the jQuery object, allowing you to use the matched elements further. Surel...

In java, how do I create my own xml subclassed elements in a DOM returned by 3rd party tools.

So I'm using HTMLCleaner which returns a org.w3c.dom compatible DOM. Now, I want to insert my own subclassed Elements (which implement additional functionality outside the dom) into this dom tree. Is this possible? If you use the Document.createElement(), you can't say that you want it to create your implementation of an element. Ideall...

HTML DOM: How to call a SELECT box's update method?

Hey, I'm writing a VB application that interacts with the HTML DOM. If I go to this page: https://edit.yahoo.com/registration And then try to change the "I prefer content from" SELECT box in the top right to "Yahoo! Asia" from the default option selected, I can do so using this command: Document.Forms.regFormBody.preferredcontent.se...

What sort of memory leaks should I watch for with jQuery's data()?

Should I pair every data() call with a later removeData() call? My assumptions: jQuery's remove() will remove elements from the DOM, and if I don't have any other references to remove, I don't have to do any more clean up. However, if I have some javascript var or object referring to one of the elements being removed, I'll need to clea...

preventing JS running when the page is not loaded

I have encountered a problem. When I use jQuery to load a page that contains heavy javascript, the page freezes. I believe it is because the js executes before the page loads as my local site does not freeze. However, $(document).ready(function(){}); seems not working with dynamically loaded pages? is that true? or anything i could do to...

Javascript question: Detecting children currently in view within an 'overflow: auto;' parent element?

See title. Additionally, how can I tell if a given child element is only partially or else wholly out of view (that is, not within the currently scrolled portion) of my 'overflow: auto;' parent element? ...

Delayed DOM update in IE6 using jQuery

I'm wrestling with a ridiculous problem in IE6. I render a page full of data on the server-side, and then iterate through the results (rows of an HTML table) on the client side, updating each row in sequence with the results of an AJAX call on each row. (I don't want to use .each(), don't ask...) IE6 will not show anything on the client...

How to neutralize injected remote Ajax content?

I'll be inserting content from remote sources into a web app. The sources should be limited/trusted, but there are still a couple of problems: The remote sources could 1) be hacked and inject bad things 2) overwrite objects in my global names space 3) I might eventually open it up for users to enter their own remote source. (It w...

org.w3c.dom.Document to XML string using Groovy

I have an org.w3c.dom.Document instance which I need to convert to an XML string. I know how to do this in Java (using javax.xml.transform facilities), but I wondered whether there is a more "groovy" way of doing this? I've tried using a the DomToGroovy class, which successfully create a groovy script version of the DOM document. But I'...

jQuery: Creating a New DOM element and showing it

So as the title suggests I wish to create a new dom element (the HTML is generated and retrieved via AJAX). I kind of got it working but it appears hidden, and when I try to Fade In it breaks! function AddContent(Content) { div = document.createElement(Content) div.appendTo($("#contentAreas")); // $(div).f...

fixing bugs...

i am at the finish of my very first javascript and have been able to get everything working except one last bug. i have this script that calls for an overlay to display full preview of images, and a button to zoom-in/out and a button to go back. the trouble is when i first view the full image, the zoom in/out toggle works fine. but when ...

How do you access the top level of the DOM from jQuery?

Trying to figure this out... I'm trying to accessthe top level of the dom from inside an iframe. How possible is this? ...

changing document.location.href loses the DOM

I have a form where you may press a button which will give you a PDF of the current information on the form. This is done by setting window.location.href to the link to the pdf file. After i do this, none of the javascript works on the page because all form elements have value of undefined. The weird part is that the browser stays o...

IE innerHTML error

Hi, This is a little different than the questions that have already been asked on this topic! I used that advice to turn a function like this: function foo() { document.getElementById('doc1').innerHTML = '<td>new data</td>'; } into this: function foo() { newdiv = document.createElement('div'); newdiv.innerHTML = '<td>...

Preventing HTTP REQUEST on javascript DOM update

I am getting re-execution of imported js files upon a hitting a form button which calls a function to insert a DOM element into page ( in simulation to exe of an ajx callback function). The DOM insertion causes a page refresh which re-requests all files from server. Nothing big on the function call: var addFashionVideo = function() { ...

Is it possible to embed a SWF in a form using swfobject 2+ in IE6+?

I've been having endless problems embedding a dynamically loaded SWF into a HTML Form within IE 6,7,8 using swfobject.embedSwf. All the proposed manual workarounds for the problem involve creating a reference to the Object DOM element from the window object. For example: window[id] = document.getElementById(id); Where id is the id of...

problem with dom createelement and innerhtml

/*************** javascript *****************/ function here(getValue) { alert(getValue) } function aaa() { document.getElementById('asd').innerHTML = '<input type="text" name="textfield" onkeyup="here(this.value)" />' } function aaa2() { var temp = document.getElementById('asd').innerHTML document.getElementById('a...