JS のいくつかの選択オプションに css クラスを設定しています。このクラスにはマージン スタイルが含まれます。FF では動作しますが、IE と chrome では動作しません。
window.onload = function() {
replace('edit-field-region-tid');
replace('edit-tid');
}
function replace(id) {
var i = 0;
var s = document.getElementById(id);
for (i; i < s.options.length; i++) {
if (find(s.options[i].text, id, i)) {
s.options[i].setAttribute("class", "sub_options");
}
}
}
function find(str, id, option_id) {
var i;
var s = document.getElementById(id);
for (i = 0; i < str.length; i++) {
if (str.charAt(i) == '-') {
s.options[option_id].text = str.cutAt(0, "");
return true;
}
}
return false;
}
String.prototype.cutAt = function(index, char) {
return this.substr(index+1, this.length);
}
そしてCSS:
.sub_options{
margin-left:20px;
text-indent:-2px;
}
どんなアイデアでもありがとう!