平成30/ 2018-12-14 11:09
javascript/ onmouseover onmouseout ロールオーバー 画像切り替え

<a href="javascript:void(0);" onmouseover="
var cname = document.getElementById('rcmd_field<?php echo h($row["id"]); ?>').className;
if(
cname == 'lt clearfix lt_no'
){
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').src='/images/btn_s_ent_alpha.png';
} else{
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').src='/images/btn_s_entno_alpha.png';
}
" onmouseout="
var cname = document.getElementById('rcmd_field<?php echo h($row["id"]); ?>').className;
if(
cname == 'lt clearfix lt_no'
){
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').src='/images/btn_s_ent_beta.png';
} else{
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').src='/images/btn_s_entno_beta.png';
}
" onclick="
var cname = document.getElementById('rcmd_field<?php echo h($row["id"]); ?>').className;
if(
cname == 'lt clearfix lt_no'
){
    document.getElementById('rcmd<?php echo h($row["id"]); ?>').value='<?php echo h($row["id"]); ?>';
    document.getElementById('rcmd_field<?php echo h($row["id"]); ?>').className='lt clearfix<?php echo ($i==1)?' lttp':''; ?>';
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').src='/images/btn_s_entno_beta.png';
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').alt='応募しない';
} else{
    document.getElementById('rcmd<?php echo h($row["id"]); ?>').value='';
    document.getElementById('rcmd_field<?php echo h($row["id"]); ?>').className='lt clearfix<?php echo ($i==1)?' lttp':''; ?> lt_no';
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').src='/images/btn_s_ent_beta.png';
    document.getElementById('rcmd_img<?php echo h($row["id"]); ?>').alt='応募する';
}
return false;
"><img src="/images/btn_s_entno_beta.png" id="rcmd_img<?php echo h($row["id"]); ?>" width="85" height="23" alt="応募しない">
</a>


( Thanks. )
マウスオーバー画像変更スクリプト
http://www.animegif.net/tips/javascript/onmouseover.html