Tag: JavascriptParents:
Children:
-
John Resig - Processing.js (via):
I've ported the Processing visualization language to JavaScript, using the Canvas element.
Impressive, to say the least.
¶ (0)
Tags: [Javascript]
-
JavaScript: The Good Parts, by Douglas Crockford (via).
¶ (0)
Tags: [Books, Javascript]
-
Reading binary files using Ajax « nagoon97’s Weblog (via).
¶ (0)
Tags: [Ajax]
-
Javascript getElementsByClass function. I know there's one built into prototype, but I didn't want to include the whole library since I wasn't already using it. This seems to work.
¶
Tags: [Javascript]
-
JSLint, The JavaScript Verifier (via).
¶ (0)
Tags: [Javascript]
-
JavaScript Kit- DOM Table Object Methods.
¶ (0)
Tags: [Javascript, Web Development]
-
Faster JavaScript Trim.
¶ (0)
Tags: [Javascript]
-
ASP.NET AJAX Control Toolkit.
¶
Tags: [ASP.NET, Javascript]
-
AppJet: Instant Web Programming (via).
¶ (0)
Tags: [Javascript, Web Development]
-
Jash: JavaScript Shell (via, via).
¶ (0)
Tags: [Javascript]
-
Simon Willison: jQuery for JavaScript programmers. Maybe I'll use jQuery instead of Prototype for future development.
¶ (0)
Tags: [Javascript, Web Development]
-
Emprise JavaScript Charts :: 100% Pure JavaScript Charts.
¶
Tags: [Javascript]
-
SproutCore (via):
Sprout Core is a application framework written in Java Script. It’s designed for creating full applications that run inside the web browser.
MIT license.
¶ (0)
Tags: [Javascript]
Some more handy Javascript (depends on Prototype):
function toggleByClass(id, className, callback){
// shows the element with id 'id'
// and hides all other elements with class 'className'
$A($$('.'+className)).each(function(element){
$(element).style.display = "none";
})
if(id) // call it with a false id to hide all
$(id).style.display = "block";
if(callback)
callback(id, className);
}
function toggleById(id1, id2){
var a = $(id1).style;
var b = $(id2).style;
if(a.display == 'none' || a.display == ''){
a.display = 'block';
b.display = 'none';
}else{
a.display = 'none';
b.display = 'block';
}
}
I always wind up needing functions to dynamically populate the options on a <select> list, or select a given item in an existing <select>. So I've finally written them out in a reusable form:
<select id="foo" onchange="alert(this.value)"/>
<script language="javascript" type="text/javascript">
function loadSelectOptions(selectId, keys, values, selectedOption){
var list = document.getElementById(selectId)
if(!list)
return;
var selectedIndex = 0;
list.length = 0;
var found = false;
for(var i=0,n=keys.length; i<n; i++){
list.options[i] = new Option(values[i], keys[i]);
if(selectedOption == keys[i]){
list.selectedIndex = i;
found = true;
}
}
return found;
}
function selectSelectOption(selectId, value, runEvent){
var list = document.getElementById(selectId)
if(!list)
return;
var options = list.options;
for(var i=0,n=options.length; i<n; i++){
if(options[i].value == value){
list.selectedIndex = i;
if(runEvent)
list.onchange();
return true;
}
}
return false;
}
loadSelectOptions("foo",['foo','bar','baz'], ['FOO','BAR','BAZ'],'baz')
var list = document.getElementById("foo")
list.remove(1)
selectSelectOption("foo","baz")
</script>
-
Because I'm sure it'll come in handy later, here's a javascript object clone function:
function clone(obj){
if(obj == null || typeof(obj) != 'object')
return obj;
var temp = {};
for(var key in obj)
temp[key] = clone(obj[key]);
return temp;
}
Update: From feedback in the comments, a better version is:
function clone(obj){
if(obj == null || typeof(obj) != 'object')
return obj;
var temp = new obj.constructor(); // changed (twice)
for(var key in obj)
temp[key] = clone(obj[key]);
return temp;
}
¶
Tags: [Code, Javascript]
-
Destroydrop » Javascripts » Tree. dTree has worked great for me so far.
¶
Tags: [Javascript, Web Development]
-
Video: Douglas Crockford, “An Inconvenient API: The Theory of the Dom” » Yahoo! User Interface Blog (via Joseph Scott). To watch later.
¶ (0)
Tags: [Javascript, Videos]
MSDN: event Object (window). In Firefox, the event object is passed as a parameter to the event handler. In IE, there's a global window.event object. To get the element that threw the event in both Firefox and IE, you can simply use:
target = event ? event.target : window.event.srcElement
where event is the name of the parameter to the function. In Firefox it's populated, in IE it's left undefined.
-
IEBlog : Scripting Debugging in Internet Explorer. The Microsoft Script Debugger comes in handy.
¶ (0)
Tags: [Javascript]
-
codejanitor » AJAX Timeouts with Prototype.
¶ (0)
Tags: [Ajax]
-
developer.apple.com: Dynamic HTML and XML: The XMLHttpRequest Object.
¶ (0)
Tags: [Ajax]
-
XML.com on cross-domain XMLHttpRequest.
¶ (0)
Tags: [Ajax]
-
Sarissa (via) "is a cross-browser ECMAScript library for client side XML manipulation, including loading XML from URLs or strings, performing XSLT transformations, XPath queries and more. Supported: Gecko (Mozilla, Firefox etc), IE, KHTML (Konqueror, Safari)." Here's the documentation. Haven't tried it yet, but it looks excellent.
¶ (0)
Tags: [Ajax]
-
Forget addEvent, use Yahoo!’s Event Utility.
¶ (0)
Tags: [Javascript]
-
Standardista Table Sorting (via Rich Manalang):
Standardista Table Sorting is a JavaScript module that lets you sort an HTML data table by any column... It’s unobtrusive. You add a reference to the Standardista Table Sorting JavaScript files in the head of your webpage, add a class of “sortable” to the tables in your page that should be sorted and you’re done.
Awesome.
¶ (0)
Tags: [Javascript]
Ajaxian » Troubles with Asynchronous Ajax Requests and PHP Sessions. Links to Marc Wandschneider's post explaining why you need to think about about possible race conditions with session data when using Ajax. Via Keith Gaughan, who posts some good comments on the Ajaxian thread about causes and possible solutions.
In short, server-side technologies like PHP don't let you lock access to your session across requests. So, you can A. try to do some complicated locking of your own on the server. B. store the critical session data in a MySQL RAM table (or some other equivalent) which AFAIK will handle the locking for you (of course, you're still not safe in this case unless you're careful). C. give the client knowledge of what changes the session state on a server that could lead to a race condition, and make sure those requests are serialized (i.e. get a response from the server before sending the next request).
Update: Harry Fuecks has a follow-up article on this.
-
Dan Webb: Painless JavaScript Using Prototype (via Simon Willison). To read.
Also see these reference posters for Prototype (via Keith Gaughan).
¶ (0)
Tags: [Javascript, To Read]
This is the best Javascript auto-complete control I've seen.
Update: This one looks pretty good too.
Update: I was running @supra with the FireBug console open and was noticing errors every time I typed a character. It turns out there's an error in the code, but ironically in the CSS, not the Javascript. One of the default styles has:
this.actb_hStyle = 'text-decoration:underline;font-weight="bold"';
But it should be:
this.actb_hStyle = 'text-decoration:underline;font-weight:bold';
Anyway, @id really does work excellently.
So yesterday, for the first time in years, I started coding a little Javascript, so I finally had a reason to install and play with FireBug. It's great. By far the most useful feature to me so far is the interactive javascript console. You can say document.getElementById("foo") and it'll give you a debug list of all the properties for that element. And you can execute any Javascript and it'll show you the results.
It really shows the value of interactive consoles. In fact, that was the second interactive console I'd made use of for the day for a language that doesn't usually have one. I finished creating a fairly tricky API for my tagging system, and I wanted to test it all. So I whipped up my own web-based interactive console for PHP where I could type in code and have it be evaluated and see the output. I was able to run down my entire API pretty quickly and both knock out some minor errors, and convince myself that the code was probably correct. With the console I wrote I was able to run through my tests much faster than I'd have been able to any other way.
A console is so important to me that I feel kind of naked when I'm working in a language that doesn't have one. In particular, I really miss it when I'm working with Perl, especially given its baroque syntax and all the CPAN you're inevitably testing out.
|
Generated in about 0.257s. (Used 11 db queries) |
new⇒Maps of Iraq
my husband is in Scania too..hesays it's not too bad..he's been atworse...
Cristy: May 16, 3:54pm