Images on the financial tools page


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /*Link to your js file in the financial tools wizard
  2. <script src="js/tools.js" type="text/javascript">*/
  3.  
  4. /*create your images and name them tools-1 through tools-?*/
  5.  
  6. /*Below is the code to add to your js file.*/
  7. var links = new Array("",
  8. "Auto",
  9. "Business",
  10. "Debt and Credit Cards",
  11. "Insurance",
  12. "Investment",
  13. "Loan",
  14. "Mortgage",
  15. "Personal Finance",
  16. "Retirement",
  17. "Savings",
  18. "Tax"
  19. );
  20.  
  21. var imgExt = "jpg";
  22. var tdVerticalAlign = "top";
  23. var tdWidth = "50";
  24.  
  25. window.onload=addPics;
  26. function addPics()
  27. {
  28. var pageName = window.location.pathname.substring(window.location.pathname.lastIndexOf('/')+1);
  29. if (pageName == "financial_tools.html")
  30. {
  31. if (document.getElementsByClassName)
  32. {
  33. var calcTables = document.getElementsByClassName("calctable");
  34. 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>","");
  35. }
  36. else
  37. {
  38.  
  39. var tables = document.getElementsByTagName("table");
  40. var count = 1; var skip = true;
  41. for (var i=1; i<tables.length; i++)
  42. {
  43. if (tables[i].className == "calctable" && skip == false)
  44. {
  45. tables[i].insertRow(0);
  46. var newCell = tables[i].rows[0].insertCell(0);
  47. newCell.innerHTML = '<a href="' + pageName + '?type=' + links[count] + '"><img src="images/tools-' + count + '.' + imgExt + '" style="border-width:0;" /></a>';
  48. newCell.alt = links[count];
  49. newCell.rowSpan = 3;
  50. newCell.style.verticalAlign = tdVerticalAlign;
  51. newCell.style.width = "" + tdWidth + "px";
  52. count++;
  53. }
  54. else if (tables[i].className == "calctable") skip = false;
  55. }
  56. }
  57. }
  58. }
  59. var wx_locID = 'USOK0400';
  60. var wx_targetDiv = 'wx_module_9428';
  61. var wx_config = 'SZ=180x150*WX=FHW*LNK=SSNL*UNT=F*BGC=0072bc*MAP=CSC|null*DN=http';

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.