javascript 放大缩小图片

<% @ Page language = " c# "  Codebehind = " ShowPic.aspx.cs "  AutoEventWireup = " false "  Inherits = " ArtArchives.Web.QueryArchive.Browse.ShowPic "   %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  >
< HTML >
    
< HEAD >
        
< title > ShowPic </ title >
        
< LINK  href ="../../style.css"  type ="text/css"  rel ="stylesheet" >
        
< style  type ="text/css" > BODY  {  MARGIN :  0px  }
        
</ style >
        
< meta  content ="Microsoft Visual Studio .NET 7.1"  name ="GENERATOR" >
        
< meta  content ="C#"  name ="CODE_LANGUAGE" >
        
< meta  content ="JavaScript"  name ="vs_defaultClientScript" >
        
< meta  content ="http://schemas.microsoft.com/intellisense/ie5"  name ="vs_targetSchema" >
        
< script >
        
function  ZoomIn()
        {
            timerID 
=  setInterval( " AddValues() " , 100 );
        }
        
        
function  AddValues()
        {
            document.all.mImg.height 
=  document.all.mImg.height  *   1.02 ;
        }
        
function  ReduceValues()
        {
            
            document.all.mImg.height 
=  document.all.mImg.height  *   0.98 ;
        }
        
function  ZoomOut()
        {    
            timerID 
=  setInterval( " ReduceValues() " , 100 );
        }
        
function  ZoomEnd()
        {
            clearInterval(timerID);
        }
        
function  UpPic()
        {
            
//  document.all.mImg.height = ImgSize;
        
            
var  UrlArray  =   new  Array();
            
var  StrUrl  =  document.all.TextBox2.value;
            
            UrlArray 
=  StrUrl.split( " < " );
            
var  IntUrlArrayLength  =  UrlArray.length  -   1 ;
            
for  ( var  i  =   0 ; i  <  IntUrlArrayLength;  ++ i)
            {
                
var  UrlLength  =  UrlArray[i].length;
                
                
var  ImgSrc  =  document.all.mImg.src;
                
var  ImgSrcLength  =  ImgSrc.length;
                
                
var  Str  =  ImgSrc.substring(ImgSrcLength  -  UrlLength, ImgSrcLength);
                
                
if  (Str  ==  UrlArray[i])
                {
                    
//  alert(i);
                     if  (i  ==   0 )
                    {
                        document.all.TbIndex.value 
=  UrlArray.length  -   1 ;
                        document.all.mImg.src 
=  UrlArray[IntUrlArrayLength  -   1 ];
                        
break ;
                    }
                    
else
                    {
                        document.all.TbIndex.value 
=  i;
                        document.all.mImg.src 
=  UrlArray[i - 1 ];    
                        
break ;                    
                    }
                }
            }
        }
        
function  NextPic()
        {
            
//  document.all.mImg.height = ImgSize;
            
            
var  UrlArray  =   new  Array();
            
var  StrUrl  =  document.all.TextBox2.value;
            
            UrlArray 
=  StrUrl.split( " < " );
            
for  ( var  i  =   0 ; i  <  UrlArray.length  -   1 ++ i)
            {
                
var  UrlLength  =  UrlArray[i].length;
                
                
var  ImgSrc  =  document.all.mImg.src;
                
var  ImgSrcLength  =  ImgSrc.length;
                
                
var  Str  =  ImgSrc.substring(ImgSrcLength  -  UrlLength, ImgSrcLength);
                
                
if  (Str  ==  UrlArray[i])
                {
                    
if  (i  ==  UrlArray.length - 2 )
                    {
                        document.all.mImg.src 
=  UrlArray[ 0 ];
                        document.all.TbIndex.value 
=   " 1 " ;
                        
break ;
                    }
                    
else
                    {
                        document.all.TbIndex.value 
=  i + 2 ;
                        document.all.mImg.src 
=  UrlArray[i + 1 ];        
                        
break ;                    
                    }
                }
            }
        }
        
</ script >
    
</ HEAD >
    
< body  onmouseup ="ZoomEnd()"  leftMargin ="0"  topMargin ="0"  MS_POSITIONING ="FlowLayout" >
        
< form  id ="Form1"  method ="post"  runat ="server" >
            
< FONT  face ="宋体" >
                
< TABLE  id ="Table1"  cellSpacing ="2"  cellPadding ="0"  width ="100%"  border ="0" >
                    
< TR >
                        
< TD  style ="HEIGHT: 17px"  align ="left" >< INPUT  class ="operation"  onmousedown ="ZoomIn()"  type ="button"  value ="放大" >< INPUT  class ="operation"  onmousedown ="ZoomOut()"  type ="button"  value ="缩小" >< INPUT  class ="operation"  onclick ="UpPic()"  type ="button"  value ="上一张" >< INPUT  class ="operation"  onclick ="NextPic()"  type ="button"  value ="下一张" >< INPUT  class ="operation"  onclick ="javascript:window.close()"  type ="button"  value ="关闭" > 当前为第
                            
< asp:textbox  id ="TbIndex"  runat ="server"  BorderStyle ="None"  Width ="18px"  BackColor ="#FFF1CF" ></ asp:textbox > &nbsp;  
                            总计
                            
< asp:textbox  id ="TbCount"  runat ="server"  BorderStyle ="None"  Width ="18px"  BackColor ="#FFF1CF" ></ asp:textbox > </ TD >
                    
</ TR >
                    
< TR >
                        
< TD  style ="HEIGHT: 550px"  vAlign ="top"  align ="left" >
                            
< P ></ P >
                            
< DIV  id ="DivImg"  style ="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px"  ms_positioning ="FlowLayout" >< IMG  id ="mImg"  alt ="" ></ DIV >
                            
< P > &nbsp; </ P >
                        
</ TD >
                    
</ TR >
                    
< TR >
                        
< TD  align ="center" ></ TD >
                    
</ TR >
                
</ TABLE >
            
</ FONT >
            
< asp:textbox  id ="TextBox1"  runat ="server"  Height ="0px"  Width ="0px" ></ asp:textbox >< asp:textbox  id ="TextBox2"  runat ="server"  Height ="0px"  Width ="0px" ></ asp:textbox ></ form >
        
< script >
        
        document.all.mImg.src 
=  document.all.TextBox1.value;
        timerID 
=   0 ;
        
//  ImgSize = document.all.mImg.height;
         </ script >
    
</ body >
</ HTML >

你可能感兴趣的:(JavaScript)