dom

Is there a case where self.location != document.location?

In Javascript, is there a case where self.location != document.location? ...

In YUI3 why does Y.one return null?

I've got a webpage that validates as XHTML 1.0 Strict. I'm using YUI3 and I'm using the seed-file-based instantiation. In several places in my javascript code, I'm doing something like: YUI().use("node", function(Y){ var node = Y.one("#my_element_id"); }); It works great, cross-platform, cross-browser, etc. in almost every case. How...

Changing the size of the SVG image using JavaScript?

Hi, I have a .svg file that has the following code: <svg version="1.1" x="0" y="0" width="256" height="256" viewBox="0 0 335 394"> plus a ton more code (namespaces etc) that is unnecessary to this situation, but the problem I have is that I need to somehow alter that width and height (from 256px to arbitrary size) using JavaScript. T...

Nodes and Elements in the DOM

Why are Element objects a subclass of Node objects? Aren't elements and nodes the same thing, with different names? Or are there other kinds of Node? ...

Insert created element at start of html tag using PHP DOM

Hi All, I'm trying to insert an HTML <base> tag immediately after the opening <head> tag of a page using dom. I've tried using appendChild which just inserts it before the </head> which is no good. Code im using: $head = $dom->getElementsByTagName('head')->item(0); $base = $dom->createElement('base'); $base->setAttribute('href', $url)...

Representation of comment tag.

From URL i am extracting the content in that all the tag coming in one page. I want to filter the comment tag before submitting this content. I filtered some tag say , which is not required to me. But I didn't find any interpretation for comment tag. I can catch the node element for comment tag. So i want tag representation for comment ...

Do I need to detach events in jQuery when I remove elements

I have a UI using dynamic tabs, so content can be loaded into a tab and then the tab can be closed and the content removed from the page. When I load content into a tab I attach a lot of events to elements using jQuery. What happens when I remove these elements from the page? Does jQuery need to know? Also, does it matter if I attach ...

JQuery style dom manipulation in C#

Hi, I'm trying to perform some dom manipulation, mainly selection of all clild elements of a parent element such as a div of id=... or class=... Is there some lightweight method of doing this. Many thanks, James ...

Get HTML Tags before the document.ready(), before DOM rendering

I am looking for such a method which allows me to add, remove DOM objects of a page before the DOM has even rendered, I mean the first JS that i include in the head tag of my page can come up, look for a specific tag say and remove it from the HTML even before it is rendered, I know that the javascript call is blocking so as the browser...

ASP.NET List Item IDs

The <li> tags generated by ASP.NET when I programatically add ListItems to my ListBox control do not have ID attributes. Is there any way that I can get them to have IDs so that I can get references to the elements from Javascript? ...

JavaScript Dynamic onClick problem

I am trying to give a button an onclick event when a certain thing on a page changes. I have tried to do it many different ways and none have worked. What am I doing wrong? Below are what I have tried. document.getElementById(subDiv).onclick = function() { alert('Error. There is an error on the the page. Please correct that then submit...

IFrame document height returns the IFrame height not the real height

I have some javascript inside an iframe that sends the height of the iframe body to the parent page using the three frame technique at http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content The height of the iframes body always seems to come out at 900, the viewport height of the iframe. This is consistent across ...

Possible to determine if an html element is self-closed or not?

I started working on an experimental project tonight. I've realized that I need to determine if a group of selected nodes are self closing or not. For example, suppose I query the dom and get this collection of nodes: <br/><br/><p></p><div></div></br/> Is there a property on the elements that can determine which are which? Moreover,...

PHP DOM replace element with a new element

Hello, I have a DOM object with loaded HTML markup. I'm trying to replace all embed tags that look like this: <embed allowfullscreen="true" height="200" src="path/to/video/1.flv" width="320"></embed> With a tag like this: <a href="path/to/video/1.flv" style="display:block;width:320px;height:200px;" id="player"> I'm havin...

jQuery live with the ready or load event

I'm using the jQuery Tools tooltip plugin, which is initialized with $('selector').tooltip(). I'd like to call this on any current or future .tooltipper element. I figured that the following would work: $('.tooltipper').live('ready', function(){ $(this).tooltip() } But it was unsuccessful---the ready event did not fire. The same for...

Setting an event with DOM javascript

I am trying to set an event in JavaScript but it is not really working. I am pretty sure I am doing it correctly too. // in index.htm: function foo() { // Load gets code from a php file via ajax document.getElementById('div').innerHTML = load('phppage.php'); document.getElementById('element').onClick = func; } // in lib.js: func...

ASP.NET and Javascript DOM manipulation

I have an aspx page with a set of controls. A small JS script written on top of jQuery allows the user to drag "li" elements from one list to another. What I would like now is for my C# code to be able to figure out which items the user has placed in which list after the page is posted back to the server. Does anyone know how I can d...

Appending elements to DOM in a loop structure.

Dear experts, Once the page has been loaded, I would like to append an additional element for each existing elements on the page. I tried something like this: var divs=document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ newDiv=document.createElement('div'); divs[i].appendChild(newDiv); } ...

how to reference bacground image via DOM

I know im doing something wrong here: document.getElementById("body_bg_top").style.background-image:url(main_bg_top.jpg); if any one can correct me i would appriciete it ! thank you ...

Question about HTML elements and custom attributes

Possible Duplicate: Custom attributes - Yay or nay? Is it appropriate to create custom attributes for HTML elements as so: <input type='text' value='name' custom_attribute='value'> This seems a little hacky and I'm not sure if it is supported largely or exactly how it would be accessed via DOM. ...