Tuesday, October 19, 2010

Horrible Javascript Code

      var class_schedules_text = '';
class_schedules.each(function() {
class_schedules_text = class_schedules_text + $(this).html();
parts = class_schedules_text.split('</strong>');
class_schedules_text = parts[1];
class_schedules_text = '<div style="width: 280px; margin-bottom: 10px; float: left; margin-left:
5px;font-size: 12px;">'+class_schedules_text+'</div>';

What it was replaced with

var class_schedules_text = class_schedules.html().replace(/<[^b].*?>/g,'');

Remember, there are two ways of doing layout

  1. Know what you are doing and do it
  2. Use excessive markup to eventually coerce the elements into place

For instance,

box_content += "<p><div style='overflow: auto;'>
<label style='float: left; margin-right:3px;font
-size: 12px;'>Schedule:</label><ul style='margin
:0; padding:0; float: left; font-size:12px;'>"+c


box_content += "<p>"+class_schedules_text+"</p>";


  1. Amazing stuff,Thanks so much for this!This is very useful post for me. This will absolutely going to help me in my projects.Party Dresses|Sheath Wedding Dresses|Black Junior Bridesmaid Dresses

    1. Your blog is very beneficial for every reader including me. Keep doing the great work so that people like me can learn some nice and new things. I would love to read more posts on your site.Franchises UK

    2. The views across the office have made this post an interesting topic of discussion. Some more please. CleverBox Marketing - SEO Manchester

  2. Now could be the time to look to increase visitor numbers to this page. It is a great read and will appeal to a wide audience. SEO Agency Manchester