Thursday, June 28, 2007

It's a Safari out there

It's likely not surprising news to you, but a beta Safari browser has been released for Windows. Finally developers can (crosses fingers) test cross-browser functionality for Mac users who use Safari. But before I can get to that point, my OCD (not really, but kinda) forced me to notice that the extra buttons on my trackball optical don't allow me to navigate back and forward in the browser history. That's because the default of ctrl-left arrow and ctrl-right arrow don't work in Safari. Instead you have to application specifically map your mouse to ctrl-[ and ctrl-].

So far I like the Safari browser, but I don't think I've fallen for the trap that Apple laid.

Friday, June 15, 2007

Javascript setInterval() and setTimeout() argument passing

Update: I've modified the post in order to rant about IE not supporting anything after the 2nd argument. Also, I've fixed the example to remind myself of the cross-browser supported syntax.

Just a quick posting to remind myself...

setInterval( function() { fxn(arg[,args]...)} , TimeBetweenIntervals)
setTimeout( function() { fxn(arg[,args]...)} , DelayTimeBeforeTrigger)

If you have a function that doesn't need to reference elements in the DOM (IE it's not a generic function that isn't hardcoded to reference DOM elements or variables) then you can pass in text as a string.

Ex.) myInterval = window.setInterval("displayTime()",1000);

If however, you need to pass variables into an interval or timout that could vary, then use the following:

Ex.) myTimeout = window.setTimeout( function() {displayTime(document.getElementById('clockDiv'))},1000);

Your displayTime() function would accept a DOM element that it would target in order to swap out the time value. This DOM element can then vary between distinct instances of intervals. For instance, you could have a page that is timing different processes and displays the run time for each process in a different div - all of which are using the same displayTime() method to change the HTML.

Friday, June 08, 2007

TinyMCE WYSIWYG Control

Update: And then there's FCKEditor which seems surprisingly like TinyMCE but which has been picked up by Adobe and will be embedded in the next version of ColdFusion. It might not be a bad time to adopt FCKEditor as a standard HTML control if, like me, you'll more than likely still be doing ColdFusion in a few years. Ah, the main difference between the two is that FCKEditor requires that you pay money to license it.

I have a client whose site is built using classic ASP and their content management pieces use an older version of the ActivEdit software. When my client upgraded to IE7, the ActivEdit became extremely unpredictable and I recommended that we switch to a different utility. After 30-45 minutes of research I landed on TinyMCE.


TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances. TinyMCE is very easy to integrate into other Content Management Systems.



If you aren't able to use FreeTextBox for ASP.NET and you don't want to pay for a WYSIWYG control for your PHP, ColdFusion or Classic ASP, then you must check this out.





Thursday, June 07, 2007

Dynamically Appended Form Elements in Firefox

Today I spent about 30 minutes trying to figure out why my dynamically appended form elements were no longer being passed to my receiving page in FireFox when they were clearly there in IE. The problem started happening when I implemented an old trick to hide the form padding by nesting it inside of a table tag improperly. It's really simple to modify the padding of a form tag with style sheets, but old (and lame) habits are hard to break.

Of course, I did this before leaving for the night and didn't remember that edit when I resumed my development this morning. However, once I did a little research I quickly cursed myself, implemented the style sheet fix, returned my form tags to their proper (and W3C approved positions) position and shazaam!