Archive for the ‘javascript’ Category
Responsive Web Design
Tuesday, May 25th, 2010IE9 and SVG?
Thursday, January 14th, 2010Hopefully this means that IE will soon support SVG. Or even better, support canvas natively…
http://blogs.msdn.com/ie/archive/2010/01/05/microsoft-joins-w3c-svg-working-group.aspx
24 ways - web design and development articles and tutorials for advent
Tuesday, December 1st, 2009It is that wonderful time of year again. Head over to 24ways.org for you daily dose of web design and development articles and tutorials.
Bookmarklet for easy switching between development and production web environments
Monday, November 30th, 2009When I develop websites, I like to set up a development site on my local web server. I usually name it the same as the production site, but with a ‘local’ prefix. So if the production site is acme.com, my development site will be localacme.com.
I wrote a little bookmarklet for easy switching between the two sites. It checks to see if the new url starts with ‘http://local’. If it does, ‘local’ will be deleted from the url, if not, local will be inserted.
Here is the code for the bookmarklet:
javascript:(function(){u=location.href.replace(%22http://www.%22,%22http://%22);a=%22http://local%22;b=%22http://%22;l=(u.indexOf(a)==0)?u.replace(a,b):u=u.replace(b,a);location.href=l;})()
Adding server side includes to JS and CSS files
Wednesday, October 7th, 2009Add the following to apache.conf to use server side includes in JS and CSS files:
AddType application/javascript .js
AddOutputFilter INCLUDES .js
AddType text/css .css
AddOutputFilter INCLUDES .css
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride All
Order allow,deny
Allow from all
innerHTML on P fails
Wednesday, July 22nd, 2009From http://channel9.msdn.com/Wiki/InternetExplorerProgrammingBugs/
innerHTML on P fails
Using innerHTML to insert new content into a p tag seems to fail consistently in 6.0.2900.2180.xpsp.050301-1521 on XP SP2. I have a repro case located at http://www.blowery.org/test/innerhtmlandp.html for your enjoyment. Just click on the link and you’ll see IE bomb out. I’ve also seen it silently fail, but I’m yet to come up with a repro case for that.
If you use a div instead of a p, innerHTML works as expected.
This behavior is by design
according to http://msdn.microsoft.com/workshop/author/dyncontent/content.asp
“Can’t put invalid HTML in the document: You cannot assign a string to innerHTML or outerHTML that contains invalid HTML. For example, trying to replace the content of the p element with another p will fail. A p element can only contain text and inline elements. However, replacing the entire p element with another p would work just fine.”
In your repro case you insert
into exististing
. Unfortunately similar mistakes break AJAX updaters on IE. — woid
Objects and JavaScript in IE8
Tuesday, July 21st, 2009Quick observation in IE8. If you have a form element with id=”myId”, myId is available directly through JavaScript as an object.
<input type=”text” id=”myId” value=”some value” />
<script>
alert(myId.value);
</script>
55 E 87 St, New York, NY 10128
Thursday, July 16th, 2009<script type=”text/javascript”><!–
pshark_pop_propkey=25100;
pshark_pop_width=480;
pshark_pop_height=360;
pshark_pop_type=”overview”;
pshark_pop_tabs=”overview,photo,map,listings”;
pshark_pop_title=”55 E 87 St, New York, NY 10128″;
//–></script>
<script type=”text/javascript” src=”http://propertyshark.com/api/pop.js”></script>
The text is supposed to be inline
, but is it really?
And what about this
, i’m not sure
Detect IE7 in JS
Tuesday, June 30th, 2009if (window.XMLHttpRequest) {
// IE 7, mozilla, safari, opera 9
} else {
// IE6, older browsers
}
Using JavaScript to read CSS from external file
Tuesday, June 30th, 2009function get_style( obj, cssprop ){
if (obj.currentStyle){ // IE
return obj.currentStyle[cssprop];
}else if (document.defaultView && document.defaultView.getComputedStyle){ // DOM
return document.defaultView.getComputedStyle(obj, “”)[cssprop];
}else{ // get inline style
return obj.style[cssprop];
}
}