17.4.12

Select Variety Use CSS

Menghiasi komponen select dengan sentuhan variabel CSS sederhana.


Diberi sentuhan sedikit javascript agar multifungsi! This is final coded

<style>
select {
padding:4px 6px 3px;
background:#fff;
border:1px solid #ddd;
border-radius:5px;
width:99%;
font-family:Arial;
margin:0 0 10px 0
}
select option {
padding:1px 0 1px 10px;
outline:none
}
</style>

<select onchange="nav(this)">
<option>Select you want...</option>
<option value="http://.com/">Beben Koben</option>
<option value="http://.com/">Ben Tools</option>
<option value="http://.com/">Undercover Blogger</option>
<option value="http://.com/">Embah Google</option>
</select>

<script type="text/javascript">
function nav(sel) {
if (sel.selectedIndex == -1) return;
var opt = sel.options[sel.selectedIndex];
if (opt && opt.value)
location.href = opt.value;
}
</script>