Massive thanks to the super hero Nicholas Wellcome for this awesome piece of javascript. It allows you to draw a polygon in a clockwise order and then it breaks it into separate polygons - effectively allowing concave to multiple convex polygon conversion. And the best bit? He's provided his nicely commented source code!
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
Friday, May 04, 2012
Friday, October 22, 2010
Javascript Everyone Should Know - Iterating URL Args
Here's some javascript I'm often looking for, because I can't remember it off the cuff after 3 months of LINQ coding and I've started writing something where JQuery isn't available...
It iterates through all the parameters and their arguments passed in the URL...
var url = window.location.toString();
var query_string = url.split('?')[1];
var params = query_string.split("&");
for (var i = 0; i < params.length; i++)
{
var name = params[i].split("=")[0];
var arg = params[i].split("=")[1];
alert(i+': '+name+' = '+unescape(arg));
}
It iterates through all the parameters and their arguments passed in the URL...
var url = window.location.toString();
var query_string = url.split('?')[1];
var params = query_string.split("&");
for (var i = 0; i < params.length; i++)
{
var name = params[i].split("=")[0];
var arg = params[i].split("=")[1];
alert(i+': '+name+' = '+unescape(arg));
}
Friday, August 20, 2010
Javascript: Finding All The Properties Of A JScript Object
Just a little function to dump out into an alert all the properties, methods, etc of any javascript object...
function listout(obj) {
var keys;
for (var key in obj) {
keys += key + ' , ';
}
alert(keys);
}
Friday, August 13, 2010
JQuery
A few JQuery links:
- JQuery site:
http://jquery.com/ - JQuery UI building:
http://jqueryui.com/ - 20 Advanced JQuery effects:
http://www.webdesignerdepot.com/2010/07/20-demos-showing-advanced-jquery-effects/ - Setting cookies with JQuery:
http://www.electrictoolbox.com/jquery-cookies/
Subscribe to:
Posts (Atom)