make submits css'able

Re: make submits css'able

by Andrew Walker -
Number of replies: 0
According to Microsoft attribute selectors will make it into IE 7 - though they aren't included in the first beta release.

http://blogs.msdn.com/ie/archive/2005/07/29/445242.aspx

of course by the time that is released everyone else will already be supporting CSS 3 selectors wink

until this can be done with pure CSS - and if you're desperate to have styled buttons - it might be a case where some javascript could help,

function styleButtons() {
if (!document.getElementsByTagName) return;

var inputs = document.getElementsByTagName('input');
var i = inputs.length;
while (i--) { // loop through all input tags on the page
var type = inputs[i].getAttribute('type').toLowerCase();
if (type == 'submit' || type == 'button') { // and apply a class to the buttons
inputs[i].className = 'button-class';
}
}
}

if (window.addEventListener) {
window.addEventListener('load', styleButtons, false);
} else if (window.attachEvent) {
window.attachEvent('onload', styleButtons);
}

Average of ratings: Useful (1)