Posts Tagged ‘html’

Internet Explorer 7 double padding submit button

Internet Explorer is the nightmare of every web-developer. As you go lower and lower with the version numbers (8-7-6) it’s going to make more and more headache for you.

Recently I found a very nasty bug in IE7. When creating a search form, my submit button did not appear as I wished, like in Chrome, Firefox, IE8. Added a default 10px padding to the left and right of the button.

IE7 ignored all of the horizontal padding I specified with css.

After some googling I found the solution:

Before:

<input type=”submit” value=”Submit button NOT OK” style=”padding: 20px;” />

After:

<input type=”submit” value=”Submit button OK” style=”padding: 20px; overflow: visible;” />

Note: the example above is correctly visible only in IE7!

Open .xls HTML content with Open Office

It looks like there’s a little bug in Open Office… If you have an .xls file with HTML content, if you open it with Microsoft Excel, it will look like an Excel table, but if you try to open it with Open Office, the HTML content will be displayed instead of the table.

Here’s how you can make it to work:

- instead of trying opening the file by double clicking it from Explorer, open a new, clean Open Office Calc spreadsheet, and open the file by selecting from the menu: File->Open.

Here is a small code to test it:

a b c
1 2 3
4 5 6
7 8 9

Check all uncheck all HTML checkboxes with Javascript

The following little piece of code shows how to check all / uncheck all HTML checkboxes with simple Javascript, without jQuery. It’s not something hard to do, but as I use it a lot, it’s nice to have it at one click…

<form name=”formname” method=”POST” action=”?action=dosomething”>

Check all: <input type=”checkbox” name=”checkall” id=”checkall” value=”Check All” onclick=”Check(‘formname’,$(‘.check_list’))”>

Option 1<input type=’checkbox’ class=”check_list” name=”check_list[]” value=”1″>
Option 2<input type=’checkbox’ class=”check_list” name=”check_list[]” value=”2″>
Option 3<input type=’checkbox’ class=”check_list” name=”check_list[]” value=”3″>

</form>

The corresponding Javascript code:

function Check(form_name,chk){ // alternate check all/check none of items

if(eval(“document.”+form_name+”.checkall.value”)==”Check All”){
for (i = 0; i < chk.length; i++)
chk[i].checked = true ;
eval(“document.”+form_name+”.checkall.value=’UnCheck All’”);
}

else{
for (i = 0; i < chk.length; i++)
chk[i].checked = false ;
eval(“document.”+form_name+”.checkall.value=’Check All’”);
}

}