小问题很急
<a href= "# "> <img src= "images/topBtnSearch.gif " border= "0 " align= "absmiddle " title= "Search " onclick= "javascript:ClickSearchButton(0); " /> </a>
<a href= "# "> <img src= "images/topBtnCancel.gif " border= "0 " align= "absmiddle " title= "Cancel " onclick= "javascript:ClickCancelButton(); " /> </a>
在ClickSearchButton中如何Search按钮变灰,让Cancel按钮由灰变为可用
------解决方案--------------------如果改为是按扭的话
是不是这个函数的效果呢?
<script>
function ClickSearch(){
if ((document.getElementById( "Search ").value)!= " "){
document.getElementById( "Search ").disabled = true;
document.getElementById( "Cancel ").disabled = false;
}
}
function ClickCancel(){
if ((document.getElementById( "Cancel ").value)!= " "){
document.getElementById( "Search ").disabled = false;
document.getElementById( "Cancel ").disabled = true;
}
}
</script>
------解决方案-------------------- <a href= "# "> <img id= "imgSearch " src= "images/topBtnSearch.gif " border= "0 " align= "absmiddle " title= "Search " onclick= "javascript:ClickSearchButton(0); " /> </a>
<a href= "# "> <img id= "imgCancel " src= "images/topBtnCancel.gif " border= "0 " align= "absmiddle " title= "Cancel " onclick= "javascript:ClickCancelButton(); " /> </a>
function ClickSearchButton()
{
document.getElementById( "imgSearch ").disabled = true;
document.getElementById( "imgCancel ").disabled = false;
}
------解决方案--------------------换图片就是设置src属性,不过没有什么意义啊?还是可以点击啊
下面是更换图片设置的函数,自己可以修改
function ClickSearchButton(Search){
document.getElementById( "Cancel ").setAttribute( "src ",Search.getAttribute( "href "));
}