I'm developing a web chat and I need to raise an event when the conversation has changed so the page title changes so one user can know that the other user has written anything.
So I tried the code:
addEvent(window,'focus',function(){ alert(1); } );
and
addEvent(document,'focus',function(){ alert(2); } );
but it does not work.
...
When iterating over an object's properties, is it safe to delete them while in a for-in loop?
For example:
for (var key in obj) {
if (!obj.hasOwnProperty(key)) continue;
if (shouldDelete(obj[key])) {
delete obj[key];
}
}
In many other languages iterating over an array or dictionary and deleting inside that is uns...
So far, I'm using
$(this).attr('class');
But I worry about compatibility because I know some browsers do some weird things with class and id attributes. Seems like a great place for jQuery to implement its own method, but I can't find it in the documentation.
Isn't there a bug somewhere that has className and id acting on the same ob...
I have two selection boxes in the same form. I would like to have one disabled based on some of the options that can be selected in the other selection box. I'm looking for a solution in JavaScript if possible.
...
Does anyone have experience with the APIs of registrars like GoDaddy?
The goal is to use Javascript to check the availability of domain names. Someone asked a related question on StackOverflow, but the answers focused on WHOIS.
I'm hoping someone provides a more robust, JSON-based API for checking domain availability. It seems natura...
You can grab data from here. Instead of saving JSON as a separate variable within the script file, is it possible to create a file pointer, and populate a Tree with one config option? Saving JSON in a variable does the job, but it's quite cumbersome!
...
Is there a better way to concatenate strings that have "'s (such as HTML tag attribute definitions) in jQuery than escaping the quote?
Escapy Example:
$(this).prepend("<label for=\""+$(this).attr("id")+"\">"+"a"+"</label>");
...
I've a jqGrid v3.7.2, after hiding a column using
.jqGrid('hideCol', infoName);
and setting the grid width using
.setGridWidth(setWidth, true)
The columns do not expand to fill the table width in IE8 only.
The table width is correct. The tbody/col widths comes short.
Any way to solve this problem via CSS? Or is there another meho...
Hi,
I have the following regex: ^[a-zA-Z](.*)[a-zA-Z]$ on both the Javascript and PHP side that I have been using for validating a person's name and message fields on a contact form (no database interaction). It basically ensures that the first and last character in the field are alphabets, and allows anything else in-between.
My conc...
I can only retrieve the value without the newly pressed key. Using the keyup event isn't an option, because it does not fire if the user doesn't release the key. This is important because I want to act upon every single keypress.
Combining the old value with the keyCode that is reachable from the event's arguments isn't acceptable eithe...
What's the simplest platform for building a little stand alope app, that can run from the status bar on mac and windows (xp, vista, 7)
It will be done in html/css/javascript and talk to the online web application through ajax calls.
I was thinking adobe air might be best?
...
I'm sending 2 cookies to the browser. One is a browser identifier which expires in 1 year, and the other is a session tracker without an expiration. The response headers for a fresh request look like this
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-XSS-Protection: 0
ETag: "b502a27282a5c621f34d522c3fcc8e3e"
Set-Cookie: bid=a...
Is there a way to view the jQuery (or Javascript) generated HTML - for example, see the jQuery-modified source of a page that uses a number of prepend()'s html()'s etc.?
...
System.Web.Script.Serialization.JavaScriptSerializer s = new System.Web.Script.Serialization.JavaScriptSerializer();
result = s.Deserialize<Hashtable>(data);
Error is thrown if data is "{a:\"\"test\" 123\",b:\"hello\" }"
No error is thrown if data is "{a:\"test 123\",b:\"hello\" }"
How do I adjust the data string so that no error is ...
Hi everyone,
I'm trying to create a switch statement but I can't seem to be able to use an expression that gets evaluated (rather than a set string/integer). I can easily do this with if statements but case should hopefully be faster.
I'm trying the following
function reward(amount) {
var $reward = $("#reward");
switch (amount...
I want to make a div that expands to reveal its content when clicked. What I did to date is:
Created a div, set to overflow:hidden
Created a JS function that toggles the height of the div between "minimized" and "maximized" (20px height and XYZpx height).
So far everything works, except I don't know how to get the height of the conte...
Hi,
I have a table with links in the html document and they looks something like (first link is just javascript:):
javascript:
javascript:SelectField('{a guid}','2');return false;
javascript:SelectField('{a guid}','23');return false;
javascript:SelectField('{a guid}','1');return false;
javascript:SelectField('{a guid}','14');return...
Hi all,
How can I round a decimal number in Javascript to the nearest 10? My math is pretty rubbish today, it could be the 2 hour sleep :/
Some sample cases
$2823.66 = $2820
$142.11 = $140
$9.49 = $10
I understand I probably need a combination of Math.round/floor but I can't seem to get expected result.
Any help/pointers appreciat...
Hello I have two dependants select box, the second one is popularited after onchange event.
The first one is loaded with a selected value (selected=selected), what I'm asking, it is possible to send the requested while the page is loading, ie as I have the the selected option, just send the request.
Javascript
function getXMLHTTP() {
...
how can i change the size of an html canvas through a function? i tried Width=123;"
and canvas.style.Width=123 canvas.width=123 neither of them worked heres the HTML code for the canvas <CANVAS id="canvas" width="460px" height="800px"></CANVAS> and in the css canvasarea { width: 460px; height: 800px;
...