Is it possible to determine styles in a CSS file through Javascript?
I am trying to detect CSS properties that will be applied to an element in a certain state, :hover in this case, but without those properties currently being active on the element. I had thought about cloning the element, appending the clone as a sibling with display:n...
So I have an array of records retreived from a database. The array is in the format;
$rows[0]['id']=1;
$rows[0]['title']='Abc';
$rows[0]['time_left']=200;
$rows[1]['id']=2;
$rows[1]['title']='XYZ';
$rows[1]['time_left']=300;
//And so on upto 10-20 rows
What's the best/most elegant way of transferring this array over to my javascript...
I know innerHTML is supposedly evil, but I think it's the simplest way to change link text. For example:
<a id="mylink" href="">click me</a>
In JS you can change the text with:
document.getElementById("mylink").innerHTML = new_text;
And in Prototype/jQuery:
$("mylink").innerHTML = new_text;
works fine. Otherwise you have to rep...
I have a funciton that I am currently using to show a hidden div.a_type
How can I modify this code so that instead of fading in the hidden div,
I can add the new div to the DOM
jQuery(function(){ // Add Answer
jQuery(".add_answer").click(function(){
if(count >= "4"){
alert('Only 4 Answers Allowed');
}else{...
Hi,
I don't think this can be done "cleanly", but I'll ask anyway.
I have a system which needs to get a JSON resource via a REST GET call in order to initialize. At the moment the system waits until the onLoad event and fires an ajax request to retrieve the resource, which I don't think is the best way to do it, as the resource is need...
I'm getting this error after trying to "appendChild" to an element that was just created (in for loop).
What does this error mean?
I suppose it's not possible to append sth. to an element that doesn't really exist in DOM.
How do I fix it?
"innerHTML" works, but I don't think it's really clean and proper way to do it.
...
Hi,
Is it possible to retrieve the geometric position (i.e. top/left offsets from either the parent element, the page, etc) of a text node?
...
Hello, I've faced strange problem. While user change of check box input element on form produces adequate event programmatic change don't. How should I face this challenge? Code following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/...
Background
I'm using POST form submissions instead of links with concatenated arguments inside a Web application, so I can exercise control over input.
Unfortunately this means users can't use the quick shortcuts they know to open links in new windows, like control-clicking or middle-clicking.
Problem
I've got what seems to be a work...
There's a lot of capital C, capital S computer science going into Javascript via the Tracemonkey, Squirrelfish, and V8 projects. Do any of these projects (or others) address the performance of DOM operations, or are they purely Javascript computation related?
...
Hi, I'm trying to find any JavaScript frameworks whose sole aim is to standardize the DOM and JavaScript across all browsers.
What I'm not looking for is frameworks which create their own API to solve these common problems. I want something that will allow me to call for example myElement.dispatchEvent("click") in Internet Explorer. Not...
I am inserting the HTML response from an AJAX call into my page, but then when I try to access those elements after they have been created, it fails..
This is how i retrieve and insert the HTML:
$.ajax({url: 'output.aspx',
data: 'id=5',
type: 'get',
datatype: 'html',
success: function(outData) {$('#my_container').html(out...
Let's say I'm generating markup through server-side code. I'm generating a bunch of HTML tags but I want to add custom attributes (properties).
In JavaScript (if I had a reference to the DOM node I could write):
var myDOMNode = ...
myDOMNode.myCustomAttribute = "Hi!";
The issue here is that I don't want to qualify every element with ...
This is the issue, when I define the ddl (drop down list or select box) I don't know the selected value. When a user edits a row, the user can select an item from the list. But the selected item isn't set. I want to set the selected item when the user clicks a button to edit the row.
The proper way, I think, is to get the ddl that was ...
There is indeed method element.componentFromPoint(iCoordX, iCoordY) in Internet Explorer, but how do I differentiate a mouse click occurred in the content area of an element from the click occurred on its scrollbar in other browsers?
...
I have a webpage on my site that displays a table, reloads the XML source data every 10 seconds (with an XmlHttpRequest), and then updates the table to show the user any additions or removals of the data. To do this, the JavaScript function first clears out all elements from the table and then adds a new row for each unit of data.
Recen...
I'm writing a piece of code that requires the DOM of a website to remain frozen while arbitrary JavaScript runs. Attributes changing is fine but I can't have anything changing the original tag structure of the page!
I know in JavaScript there are a base number of functions that can modify the DOM:
appendChild( nodeToAppend )
cloneNode(...
I have this code:
var $msg = jQuery('<div></div>')
.hide()
.appendTo(document.body)
;
if ($msg.is(":hidden")) {
console.log("hidden");
} else {
console.log("visible");
}
When run, it logs "hidden" on Firefox, but "visible" on Google Chrome. Is this a bug, or am I doing something wrong?
...
When programming in C++ against the browser's DOM each engine has a different set of interfaces, IE has the COM based MSHTML, Mozilla has the XPCOM based Gecko DOM etc.
Is there a common API that has adapters for major browsers (and versions)?
As a clarification, the application in question is a desktop application written in C++ wh...
I have a Windows Forms application in C#/Visual Studio 2008 with an IE WebBrowser control. In the DocumentCompleted event, I want to search the WebBrowser.Document or WebBrowser.DomDocument to see if jQuery is already present in the page.
What's a good way to accomplish this?
Thanks!
...