dom

Brower Scroll cuts off content

I created a simple example to illustrate the issue I am having. It seems that if I have a DIV set to a specific pixel width, then resize the browser smaller until the horizontal scroll bar appears then scroll to the right, the content is cut off. Or at least some of it. http://www.artworknotavailable.com/examples/cutoff.html Am I miss...

Why does javascript strip out my dyamically javascript?

I have a javaScript that calls a function: var combineddata = jQueryGetHtml(); The function is: // Get ALL of the HTML using jQuery var jQueryGetHtml = function() { var htmlStartTag = function() { return $('html').contents(); var attrs = $('html')[0].attributes; var result = '<!DOCTYPE HTML PUBLIC "-/...

In Firefox, use a plugin or extension to invoke "unsafe" APIs?

Firefox extensions can invoke privileged APIs (e.g. nsIProcess to start an external app) without bugging the user, for example this extension does it from the download window: https://addons.mozilla.org/en-US/firefox/addon/10902/ I need to do the same kind of thing, but from a UI on a web page. Can an extension provide a XUL widget (whi...

Defer javascript execution till the content has been added to Document

I am trying to load some content into a page using Ajax. The html that is loaded contains some javascript code. Even though the code is wrapped within $(document).ready, it gets executed before the content is inserted into the document, because the parent document's Dom is ready by the time the content is loaded. How can I defer the exe...

Load two dropdowns with the same values

Hi all: Is there any problem with loading the same set of values in 2 different HTML form dropdowns? My code looks like this: var dr1=document.getElementById("dr1"); var dr2=document.getElementById("dr2"); for (nombre in elements) { var opcion=document.createElement('OPTION'); var cam=elements[nombre]; opcion.value=nombre; ...

Changing data in child iFrame issue - can't obtain a DOM object.

Hi, guys. For some reason I'm trying to parse this website: http://www.vblandrecords.com/index.aspx. I am currently trying to click Document type tab and then change From date value. I supposed I could have done it with the following code, in VBA: Option Explicit Public WithEvents ieObj As InternetExplorer Public Sub Launch() Se...

dojo clone event handlers

Hi. I'm using dojo.clone(obj) for clone DOM node, but i don't know how clone event handlers. does anybody know how do this? ...

find id of element

Is there any way of determining the id attribute of any html element. ...

javascript: can not use global variable in a function, to navigate the dom

hello, beginner here... what am i missing? i define a global variable that is a reference to an html element: var x=document.getElementById("xxx1"); then, inside a function a try to reference that variable to navigate the dom: x.innerHTML="dsfgfdgdf"; ...doesn't work; if i define the variable inside the function ...

how is the dom cached between functions in an object literal? (Javascript)

Ok I'm not sure the title of this post is the correct way to refer to what I mean and I'm pretty sure I already know the answer to this question but I just wanted some clarification. If I have an oject like this var myObj = { settings : { domObj = document.getElementById('elem1'); }, myFunc1 : function () { return this.do...

getElementById doesn't work on a node

In this simple script i get the error "obj.parentNode.getElementById is not a function", and I have no idea, what is wrong. <script type="text/javascript"> function dosomething (obj) { sibling=obj.parentNode.getElementById("2"); alert(sibling.getAttribute("attr")); } </script> <body> <div> <a id=...

Capturing multiples keystrokes in javascript.

I'm trying to do a javascript application that needs this particular feature: Whenever the user presses one of the arrow keys, it must act acording to the key direction. And if the user press a key, hold it down, and press a second one, then, only the action of the seccond one must be executed until released. And if the first one stil...

jQuery Selectors: Grabbing a section of children that are of a given tag

Say I have an arbitrary number children (e.g. "td"s) of a given element (e.g. a "tr"), and I need to grab a given number of these (say, 4) at a given position (say, 3; td's 3 - 67, in this case). What would the best query for doing this look like? Note that I could be dealing with a potentially thousands of children, so I'd like to not...

jQuery Selectors: Which is faster for grabbing a subset of children?

Following up on this question, I have the following 2 options: $("tr td").slice(3, 6); And possibly something like this (algorithmically speaking, I mean; I know making new query strings for each element is kinda silly): var subset = $( "tr td:nth-child(4)" ); for(var i=4; i<7; i++) subset.add( "tr td:nth-child("+i+")" ); Which wou...

Why can't I have a direct reference to document.createElement?

When creating lots of DOM elements, document.createElement and friends can add lots of bytes and ugliness. I know I could make my own subroutine, or use innerHTML or whatever, but why can't I just do this: var $c = document.createElement; var newP = $c('p'); Firebug complains with this message: "Illegal operation on WrappedNative pro...

How to write a file from the document in android

enter code here import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; public class Util { public static Document stringToDom(String xmlSource) throws SAXException, ParserConfigurationException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory....

Redirect to a URL and then run a function in the context of that newly loaded page when "DOM Ready"

Is there some way for me do something like the following in Javascript? ( Specifacly I want to do this from Javascript running in an Iphone OS UIWebView) create a function called RedirectAndExecuteFunctionOnDomReady(url, function) Redirect to the HTML of the provided url When the new HTML DOM is ready, execute the provided function (w...

JavaScript and DOM: Why "<table>" += "<tr><td></td></tr>" += "</table" doesn't work?

In both of these, the string content is the same. If you do this: myDiv.innerHTML += "<table><tr><td>A</td><td>B</td></tr></table>"; You get a table with two columns. If you do this: myDiv.innerHTML += "<table>"; myDiv.innerHTML += "<tr>"; myDiv.innerHTML += "<td>A</td>"; myDiv.innerHTML += "<td>B</td>"; myDiv.innerHTML += "<...

How to retrieve children of an xml data?

Hello, I have some xml data in the format below - <xyz:reqResponse xmlns:xyz="http://www.test.com/xyz/" xmlns:akt="http://www.exmple.com/akt/"&gt; <xyz:version>1.2</xyz:version> <xyz:totalRecords>659</xyz:totalRecords> <xyz:records> <xyz:record> <doc> <str name="icon_url">http://www.icons.net/ico...

Remove element when it has a specified child element

How can I delete list element if it has a child link of some defined id ? So looking at the code below I'd like to find a <li> with <a> of id=link1 and delete this li. <li class="nav-tab"> <a href="#link1">Component</a> </li> I've tried the code below but it doesn't work : $(function() { $('.nav-tab:has(#link1)').css('displ...