Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Wednesday, December 16, 2015

Unchain yourself from jQuery

As a developer, it's easy to rely on jQuery for everything. How about breaking that link on your next project.

See this post to see how easy it is to do AJAX without jQuery.

Wednesday, July 23, 2014

Javascript function to mimic c#'s String.Format() method

var format = function (input) {
var args = arguments;
return input.replace(/\{(\d+)\}/g, function (match, capture) {
return args[1*capture + 1];
});


from this github gist

Thursday, August 09, 2012

Interacting with Iframes using Javascript

// reference to iframe with id 'ifrm'

var ifrm = document.getElementById('ifrm');

// reference to window in the iframe
var win = ifrm.contentWindow;

// reference to document in iframe
var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;

// reference to a form named 'ifrmTest' in iframe
var form = doc.getElementById('ifrmTest');


http://www.dyn-web.com/tutorials/iframes/refs.php

Tuesday, May 29, 2012

Online Regex Builder makes Regex fun again

Check out tihs link: http://gskinner.com/RegExr/

It lets you

  • write regex
  • see what it matches
  • hover over sections of the regex to get a nice explanation of what it does
  • save a library of your own regex
  • browse through other people's shared libraries
Here's a screenshot :

Thursday, December 09, 2010

Geolocation from the browser to get current location

This article shows a possible good  use for using the geolocation capability which many browsers are starting to support.

Wednesday, October 13, 2010

Getting Querystring Parameter Value from Javascript

function querySt(ji) {
 hu = window.location.search.substring(1);
 gy = hu.split("&");
 for (i=0;i<gy.length;i++) {
  ft = gy[i].split("=");
  if (ft[0] == ji) {
   return ft[1];
  }
 }
}
//if you need to get param value from a URL such as 
//this one: http://domain.com?param=value
var koko = querySt("param");
I found this code at this site.