Return to Snippet

Revision: 53058
at November 11, 2011 04:55 by cchsitebuilder


Initial Code
/*Link to your js file in the financial tools wizard
<script src="js/tools.js" type="text/javascript">*/

/*create your images and name them tools-1 through tools-?*/

/*Below is the code to add to your js file.*/
var links = new Array("",
	"Auto",
	"Business",
	"Debt and Credit Cards",
	"Insurance",
	"Investment",
	"Loan",
	"Mortgage",
	"Personal Finance",
	"Retirement",
	"Savings",
	"Tax"
);

var imgExt = "jpg";
var tdVerticalAlign = "top";
var tdWidth = "50";

window.onload=addPics;
function addPics()
{
	var pageName = window.location.pathname.substring(window.location.pathname.lastIndexOf('/')+1);
	if (pageName == "financial_tools.html")
	{
		if (document.getElementsByClassName)
		{
			var calcTables = document.getElementsByClassName("calctable");
			for (var i=1; i<calcTables.length; i++)	calcTables[i].innerHTML = '<tr><td rowspan="3" style="width:' + tdWidth + 'px;vertical-align:' + tdVerticalAlign + ';"><a href="' + pageName  + '?type=' + links[i] + '"><img src="images/tools-' + i + '.' + imgExt + '" alt="' + links[i] +'"  style="border-width:0;" /></a></td></tr>' + calcTables[i].innerHTML.replace("<tbody>","").replace("</tbody>","");
		}
		else
		{
			
			var tables = document.getElementsByTagName("table");
			var count = 1; var skip = true;
			for (var i=1; i<tables.length; i++)
			{
				if (tables[i].className == "calctable" && skip == false) 
				{
					tables[i].insertRow(0);
					var newCell = tables[i].rows[0].insertCell(0);
					newCell.innerHTML = '<a href="' + pageName + '?type=' + links[count] + '"><img src="images/tools-' + count + '.' + imgExt + '" style="border-width:0;" /></a>';
					newCell.alt = links[count];
					newCell.rowSpan = 3;
					newCell.style.verticalAlign = tdVerticalAlign;
					newCell.style.width = "" + tdWidth + "px";
					count++;
				}
				else if (tables[i].className == "calctable") skip = false;
			}
		}
	}
}
var wx_locID = 'USOK0400';
var wx_targetDiv = 'wx_module_9428';
var wx_config = 'SZ=180x150*WX=FHW*LNK=SSNL*UNT=F*BGC=0072bc*MAP=CSC|null*DN=http';

Initial URL


Initial Description


Initial Title
Images on the financial tools page

Initial Tags


Initial Language
JavaScript