Skip to content
Advertisement

Tag: dhtml

Change :hover CSS properties with JavaScript

How can JavaScript change CSS :hover properties? For example: HTML CSS How can the td :hover properties be modified to, say, background:#00ff00, with JavaScript? I know I could access the style background property using JavaScript with: But I don’t know of a .style JavaScript equivalent for :hover. Answer Pseudo classes like :hover never refer to an element, but to any

Linked Dynamic Radio Buttons HTML Javascript

All, Have used this site a few times before and had some great replies so hopefully someone can help again. I want a set of radio buttons, so that when you click a button – you get another set below it. Then again, when you click one of the 2nd set of buttons, you’ll get a third etc. Currently I

Table Row’s OnClick Event is Propagated to all Contained Elements?

I’ve run into some interesting code in our legacy application running under Internet Explorer. Consider the following: So, here’s where I’m stumped. When the user selects an item from the SELECT element, the ONCLICK event is firing, and the following are true: this evaluates to Window Window.event.srcElement evaluates to an array of ‘OPTION’ elements There doesn’t seem to be a

jQuery: how to change tag name?

jQuery: how to change tag name? For example: I need Yes, I can Create DOM element <div> Copy tr content to div Remove tr from dom But can I make it directly? PS: results in DOMException. Answer You can replace any HTML markup by using jQuery’s .replaceWith() method. example: http://jsfiddle.net/JHmaV/ Ref.: .replaceWith If you want to keep the existing markup,

How do I programmatically click on an element in JavaScript?

In IE, I can just call element.click() from JavaScript – how do I accomplish the same task in Firefox? Ideally I’d like to have some JavaScript that would work equally well cross-browser, but if necessary I’ll have different per-browser JavaScript for this. Answer The document.createEvent documentation says that “The createEvent method is deprecated. Use event constructors instead.” So you should

How to load up CSS files using Javascript?

Is it possible to import css stylesheets into a html page using Javascript? If so, how can it be done? P.S the javascript will be hosted on my site, but I want users to be able to put in the <head> tag of their website, and it should be able to import a css file hosted on my server into

Cross-browser way to determine whether a DOM event was cancelled

Is there a cross-browser way from a Javascript event handler to determine whether the event has been cancelled by a previous handler? IE and other browsers like Chrome etc. have an event.returnValue property that can be tested, but FireFox doesn’t appear to have any such property. Here’s an example of the scenario I’m talking about. You have a form like

Print only?

How do I print the indicated div (without manually disabling all other content on the page)? I want to avoid a new preview dialog, so creating a new window with this content is not useful. The page contains a couple of tables, one of them contains the div I want to print – the table is styled with visual styles

Best Javascript drop-down menu? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

Advertisement