dhtml

Best practice for defining CSS rules via JavaScript

I'm loading a stylesheet that is only required when javascript is enabled. More to the point, it mustn't be present if JavaScript is disabled. I'm doing this as soon as possible (in the head) before any javascript libraries are loaded. (I'm loading all scripts as late as possible). The code for loading this stylesheet externally is simpl...

input type text and onKeyDown not working under IE

Hi there. I am writing a WWW application, it has to run under IE. I have the problem with the code that runs under FF, but i can't get it running under IE. // JS code function test() { if (window.event.keyCode == 13) window.location.assign("myPage.php"); } I've tried some similar ways around window.location and location.h...

getElementsByTagName() equivalent for textNodes

Is there any way to get the collection of all textNode objects within a document? getElementsByTagName() works great for Elements, but textNodes are not Elements. Update: I realize this can be accomplished by walking the DOM - as many below suggest. I know how to write a DOM-walker function that looks at every node in the document. I ...

Prototype callback functions swallowing exceptions

Hi all Using Prototype version 1.6.0.2. I have a common problem where exceptions are being swallowed when they are thrown in a callback function, typically when I am trying to handle the response to an Ajax.Request call. Here is a simple example: HTML markup: <input type="button" id="myButton" value="Press Me" /> Javascript: MYSI...

Remove "Flash" between pages while using Internet Explorer modal boxes

I have an internal web application, that is IE specific, and uses a lot of IE specific modal boxes: (window.showModalDialog). I recently received a request to remove the "flash" when navigating between pages of the site. To accomplish this, I just added a meta transition tag to my master page: <meta http-equiv="Page-Enter" content="ble...

DHTML with Javascript and CSS is not working

So for some reason this unobtrusive javascript code is not working and I can't figure out for the life of me why it won't work. I dynamically change the className of a div element and therefore I expect the CSS to reflect that change. However it doesn't. Here's the simplified code. html: <head> <title>Your Page</title> <link r...

JavaScript accordion effect won't work, something to do with pseudoclass?

I tried to make an accordion effect with JavaScript based off this video altering a few things like using an input button instead of a link for the selector. However for some reason it's not working. Firefox error console outputs unkown pseudo-class or pseudo-element "visible" everytime I try to use it. What's the problem? $("div.exampl...

Hide Dynamically Added Columns/Fields

I have some dynamically created rows/columns. What I'd like to do is set a section of it (txtOffsetID) to be hidden. I tried this: txtOffsetID.setAttribute('type', 'hidden'); but it didn't work. I want to hide that entire column and any new columns added. I need it to work in IE. Thanks. Sample code: function addNewOffsetItem() ...

opening a new page and passing a parameter to it with Javascript

I have a JS function that processes XML I GET from a server to dynamically create a table as below // Generate table of services by parsing the returned XML service list. function convertServiceXmlDataToTable(xml) { var tbodyElem = document.getElementById("myTbody"); var trElem, tdElem; var j = 0; $(xml).find("Service")....

"return false" is ignored in certain browsers for link added dynamically to the DOM with JavaScript

I dynamically add an <a> (link) tag to the DOM with: var link = document.createElement('a'); link.href = 'http://www.google.com/'; link.onclick = function () { window.open(this.href); return false; }; link.appendChild(document.createTextNode('Google')); //someDomNode.appendChild(link); I want the link to open in a new window (I know i...

loading HTML fragments with jQuery

Hi everybody, I'm very new to jQuery, Ajax and things like these. I've found solutions on how to inject HTML fragments into my site: $(document).ready(function(){ $('a').click(openContent); //binding all anchors to this function }); function openContent(){ var path = $(this).attr('href'); $('#content').load(path); retur...

Call a Firebug command from client code.

I would like to apply some sort of IoC, with debugee code, i.e. the current HTML document, and the debugger, Firebug. It would be great to have some sort of document that asks Firebug to open a push channel from the document, versus the more common scenario of the debugger pulling information from the debugee document. Is this possible...

is it possible to mix DHTML and Applet for Drag and drop?

I am working on some example to find if a Div (DHTML) on to Java Applet in a web page. I used YUI JS Drag drop library to make the div as droppable item and made the div surrounding the Applet as Drop Target. When I dropped it in the Div containing Applet, I am Calling some method in the applet from Javascript Drop handler? This is fine...

Why does my DHTML menu have huge layout issues in IE7?

This one's got me stumped. Usually with a little CSS juggling here and there I am able to solve most IE7 CSS bugs, but not this one! Head on over to the example page and view it in IE7, you will soon see that when mousing over the (vertical) drop down menu on the left of the page, it opens the sub menu WAY over to the right. I have pull...

Problems with multiple setIntervals running simultaneously

Hello, My first post here. I want to make a horizontal menu with submenu's sliding down on mouseover. I know I could use jQuery but this is to practice my javascript skills. I use the following code: var up = new Array() var down = new Array() var submenustart function titleover(headmenu, inter) { submenu = headmenu.lastChild up...

Can't toggle display of table rows in IE with getElementsByName()

I want to show and hide rows of a table based on the value of a select box and this works in Firefox but not IE: <select onChange="javascript: toggle(this.value);"> <option value="cat0">category 0</option> <option value="cat1">category 1</option> </select> <table> <tr name="cat0"> <td>some stuff v</td> <td>some stuff v</td> </tr>...

Why am I not seeing anything for IE 8.0 for the following page?

http://havanasanjuan.com/ FF seems fine.I know this is something trivial. ...

Displaying HTML contents over an applet - wmode transparent?

For Flash content, I can set wmode="transparent" and display HTML menus over my Flash animation. Is something similar possible for Java applets, too? ...

mint.com javascript dropdown effect

I need to recreate an effect that mint.com has on another website. When you go to the transactions page and click on one of your transactions a tab pops up underneath that says edit details. When you click on that tab a div will drop down exposing more details about the transaction. I don't even know what this kind of effect this is call...

using php and java script in a form

I am a little bit lost. What I want to achieve is: my own custom button change onMouseOver etc' keep it's size post the information to a php server side code What I'm missing is: The post - I couldn't figure out how to combine js & php The Button size - my code sets a size for the original button but after the rollover it changes ...