飛來紫

waya

   :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

點擊顯示或隱藏某個頁面元素

<script language="javascript">
    
function show(topicid){
        
var targetDiv=eval("tr_"+topicid);
        
if(targetDiv.style.display!='block'){
            targetDiv.style.display
="block";
        }
else{
            targetDiv.style.display
="none";
        }

    }

</script>

<span onClick="javascript:show('10');">顯示/隱藏</span>

<table>
    
<tr id="tr_10" style="display:none">
        
<td>M</td>
    
</tr>
</table>

刪除可審核時的確認窗口
<script language="javascript">
    
function opConfirm(){
      
if(confirm('你確認嗎?')){
         window.open('h.html','','');
//確認後打開一個窗口
      }

    }

</script>

開啟定制窗口,指定窗口大小,或指定窗口在屏幕中的位置
function screenwidth() {//屏幕的寬
    var screenX;
    
if(navigator.appName == "Microsoft Internet Explorer"{
        screenX 
= window.screen.availWidth;
        }

    
else {
        screenX 
= window.screen.availWidth
        }

    
return screenX;
}


function screenheight() {//屏幕的高
    var screenY;
    
if(navigator.appName == "Microsoft Internet Explorer"{
        screenY 
= window.screen.availHeight;
        }

    
else {
        screenY 
= window.screen.availHeight
        }

    
return screenY;
}


function popupfull(pageurl) {//全屏窗口
    var wHeight;
    
var wWidth;
    wHeight 
= screenheight() - 100;
    wWidth 
= screenwidth() - 50;    
    
var options = 'toolbar=0,location=0,scrollbars=1,resizable=1,dependent=1,top=20,left=20,width='+wWidth+',height='+wHeight
    window.open(pageurl,'Sample_PopupFull', options).focus();
    
return false;
}

function popupright(pageurl) {//居屏幕右邊的窗口
    var wLeft, wHeight;
    wLeft 
= screenwidth() - 430;
    wHeight 
= screenheight() - 100;
    
var options = 'toolbar=0,location=0,scrollbars=1,resizable=1,dependent=1,top=20,left='+wLeft+',width=400,height='+wHeight
    window.open(pageurl,'Sample_PopupSM',options).focus();
    
return false;
}
posted on 2006-12-15 10:41  waya  阅读(307)  评论(0编辑  收藏  举报