Web

Quick Tip About CSS Tables

Tables using only CSS… not really all that much work, but I am not really sure why it makes so much difference. Basically you have a table structure in DIV tags,

<div class='table'>
    <div class='row'>
        <div class='cell'>Cell A</div>
        <div class='cell'>Cell B</div>
    </div>
    <div class='row'>
        <div class='cell'>Cell C</div>
        <div class='cell'>Cell D</div>
    </div>
</div>

then you create styles for the classes as follows:

.table {display:table;}
.row {display:table-row;}
No votes yet

When Ajax Was Still Just a Cleanser

A few years ago the company I was working for did the SimCityScape web interface, which was the online component to the SimCity 2 game (EA Games/Maxis). I was the developer assigned to do the high-end JavaScript and any other programming for the site, while the CSS and design work was done by one of our graphic designers. One of the requirements was that the game interface should not have to reload when an action is performed…

No votes yet

Velociscript

I was toying with the idea of velocity-like expression evaluation and replacement on the client-side and I came up with this handy little JavaScript function:

function ev(str,model){
    var buf = "";
    for(var t=0; t<str.length; t++){
            var tok = str.charAt(t);
            if(tok == "$" && str.charAt(t+1) == "{"){
                    t += 2;
                    tok = str.charAt(t);

                    var expr = "";
                    while(tok != "}"){
                            expr += tok;
No votes yet

Dynamic Script Loading

I figured out a way to dynamically load JavaScript files at runtime. There are times when you may not always need to import all of your external JavaScripts, or maybe you are using Ajax to load content into a div and you also need to import some script that the content needs. Here is the solution and it works in IE and FireFox:

function loadLibrary(path){
    var headElt = document.getElementsByTagName("head").item(0);
    var scriptElt = headElt.appendChild(document.createElement("script"));
No votes yet