Another IE Bug: Unnecessarily Duplicating Text

Aug

25

This issue has puzzled me for quite some time, and finally after some research I was able to figure out just what the heck was going on.

The Problem

For some odd and seemingly unexplainable reason, IE will display duplicate/repeating characters even though the code does not represent this.

...
      <div id="thumbnails" style="display:none;"></div>
      <div id="story" style="position:relative;float:right;">
         < ;p style="position:relative;float:right;">01.01.01</p>
         < ;h2>Title</h2>
         < ;p>Lorem Ipsum ...</p>
      </div>
   </div>
   <div id="footer">
      <a href="http://xxx" title="Click here to go to the main page.">home</a>
      &nbsp;|&nbsp;< br />       <a href="http://xxx" title="Click here to go to the about page.">about</a>
      &nbsp;|&nbsp;< br />       <a href="http://xxx" title="Click here to go to the photos page.">photos</a>
      &nbsp;|&nbsp;< br />       <a href="http://xxx title="Click here to go to the contact us page.">contact</a>
      &nbsp;||&nbsp;
      <a href="http://xxx" title="Click here to go to the site map.">site map</a>
      <br />
      &copy;&nbsp;20 06  <a href="http://www.tricklin.com">tricklin.com</a>
   </div>
   <!-- end 'footer' -->
</div>
<!-- end 'page' -->
...

Read the rest of this entry »

feedtag thisdigg this

Alternating Row Colors Using Only JavaScript

Apr

05

Below is a JavaScript that will make alternating the row colors of a table extremely simple. The beauty of it is that the script is only 16 lines long!

function alternateRowColor(tableid,lightclass,darkclass,overclass) {
    var tableid = document.getElementById(tableid);
    var rows = tableid.tBodies[0].rows;
    for(var ii = 0; ii < rows.length; ii++) {
        var row = rows[ii];
        if(ii % 2) {
             row.className = lightclass;              row.onmouseover = function () {overRow(this.id,overclass);};
             row.onmouseout = function () {overRow(this.id,lightclass);};
        } else {
         &nb sp;  row.className = darkclass;
         &nb sp;  row.onmouseover = function () {overRow(this.id,overclass);};
         &nb sp;  row.onmouseout = function () {overRow(this.id,darkclass);};
        }
    }
}

I've added a nice little row highlighting function to the mouseover and mouseout events called overRow(). This function only adds 3 lines of code:

function overRow(rowid, classname) {
    document.getElementById(rowid).clas sName = classname;
}

The last thing to do is make sure that the alternateRowColor() function gets invoked every time the page loads. Instead of having to place this in the body tag of all pages, all that is needed is one line of code added to the same script that will automatically run the function each time a page loads:

window.onload=function(){ alternateRowColor('alternateRows','light','dark','over');}

That's all there is to it. See it in action.

feedtag thisdigg this

Simple AJAX Example Using ColdFusion

Mar

03

As I mentioned in my previous post, I planned on creating a "tutorial that will walk you through a real world working example of AJAX using ColdFusion and a simple MS Access Database." Well, here it is:

In order to represent a working example of AJAX, there are a few things we're going to need.

  • database
  • HTML file
  • JavaScript (located within the HTML file in this example)
  • ColdFusion file (note: any programming language can be used)
  • prototype JavaScript library

The Database

The database used in this example is an extremely basic MS Access database consisting of one table that contains 6 fields:

Table Name:  Employee
Field Name Data Type
EmpID AutoNumber
FirstName Text
LastName Text
JobTitle Text
Phone Text
Fax Text

Now that we know what we are going to be storing, let's take a look at the ".html" file.

HTML File

This file will consist of the form fields needed to populate the database, along with the placeholder we will use to show the information being stored:

<form name="addEmployee">
First Name:<input type="text" name="FirstName" id="FirstName" value="" size="30" />
<br />
Last Name:<input type="text" name="LastName" id="LastName" value="" size="30" />
<br />
Job Title:<input type="text" name="JobTitle" id="JobTitle" value="" size="30" />
<br />
Phone:<input type="text" name="Phone" id="Phone" value="" size="12" />
<br />
Fax:<input type="text" name="Fax" id="Fax" value="" size="12" />
<br />
<input type="button" name="submit" value="save" onclick="insertEmployee();">
</form>
<div id="EmployeeList"></div> //placeholder div

Notice how there is no method or action in the form tag? Both of these will be taken care of by the JavaScript.

Read the rest of this entry »

feedtag thisdigg this

Tricklin On...