Tag Archives: javascript

Javascript and PHP Size Based Styles

Javascript and PHP Size Based Styles

So you want to support different screen resolutions do you? Well, it is possible too much difficulty by creating a multiplexer for CSS files. This solution I am speaking about involves creating several style sheets for popular screen resolution groups and a cookie to save the information and redirecting when the cookie is not set. This solution should be handled with care as cookies are not always supported and could create and endless redirect.

Continue reading

Adding events to iframe javascript

Technically it is possible to add events to an iframe but there are some caveats especially in terms of browser compatibility. for starters what I have found is that you can use the window object if you are trying to attach to events such as blur, drop, and mouse or keypress.

	ifrme = document.getElementById ( 'ifrme');
	if ( typeof ( ifrme.contentDocument ) != "undefined" ){
		var win = ifrme.contentWindow||iframe.defaultView;
		var doc = win.document;
		win.addEventListener ( "blur",function(){
			alert ( "blur");
		},false);
	}

More to come soon

Javascript Character Classes

I have put together the beginnings of a javascript character class script. The idea was to create a testing platform and the build the character class handler at the same time. Starting off as a need to build a scanner/parser I was looking for some functions to give me IsDigit, IsAlpha, IsDigitAlpha and other similar functions.
Continue reading

Javascript Object Oriented Ideas

Good article on Javascript Object Oriented Ideas

If you are looking to do some “strange” things with javascript Object Oriented programming, then check out: this article. There is a lot of information on creating things like static functions, singletons, private/public functions and properties. These object oriented ideas are not 100% the same as in other languages but the results are as close to the real thing as you may need.

Bing Maps Static Maps API

Before Getting Started make sure to obtain an API key from: http://msdn.microsoft.com/en-us/library/ff428642.aspx

If you wished you could retreive Bing Maps static images for a specific location, your wait is over. I am not sure when the Bing Maps Static API offering became available but I do know that it works. The API is broken up into  several sections to make it easier to find what you are looking for.


The first section of the entire Bing Maps Static API properly named “Bing Maps REST Services API” is the Locations API which may be used to retreive information based on a location such as street address. The format of the returned data may be in JSON or XML and may be controlled with the Output Parameters found in the Common Parameters and Types. To test it out, put the following in your brower address bar:

http://dev.virtualearth.net/REST/v1/Locations/CA/Ontario/M5V2T6/Toronto/301 Front St W?key=

and add your own key to the end of the line

When the browser returns you should by default get a json string similar to the following:

{
    "authenticationResultCode":"ValidCredentials",
	"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
	"copyright":"Copyright © 2011 Microsoft and its suppliers. All rights reserved... ( see actuall result )",
	"resourceSets":[{
	    "estimatedTotal":1,
		"resources":[{
		    "__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
			"bbox":[43.640018282429324,-79.3961907073811,43.647743717570677,-79.381957292618893],
			"name":"301 Front St W, Toronto, ON, M5V2T6",
			"point":{
                "type":"Point",
				"coordinates":[43.643881,-79.389074]
		    },
			"address":{
			    "addressLine":"301 Front St W",
				"adminDistrict":"ON",
				"countryRegion":"Canada",
				"formattedAddress":"301 Front St W, Toronto, ON, M5V2T6",
				"locality":"Toronto",
				"postalCode":"M5V2T6"
			},
			"confidence":"High",
			"entityType":"Address"
		}]
	}],
	"statusCode":200,
	"statusDescription":"OK",
	"traceId":"...(See Actuall Result)"
}