2011-04-17 104 views
0

我向ASP面板添加了一個大圖像,並且它離開了面板。我想在沒有滾動條的面板中的圖像,並在與JavaScript面板中移動它。我怎樣才能做到這一點。這是我的代碼在小面板中的大圖像(圖像在面板外面)

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="move background.aspx.cs" Inherits="move_background" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head id="Head1" runat="server"> 
<title></title> 
<script type="text/javascript"> 
    Hmove = 12; 
    function moveObjRight(obj) { 
     var a = document.getElementById(obj); 
     var Left = parseInt(a.style.left); 
     var newpo = Left + Hmove; 
     a.style.left = newpo + "px"; 

    } 
</script> 

</head> 
<body> 
<form id="form1" runat="server"> 

    <asp:Panel ID="Panel1" runat="server" Height="133px" 
     style="z-index: 1; left: 0px; top: 0px; position: absolute; height: 500px; width: 1000px" 
     Width="166px" ForeColor="#990000" BackColor="#0066FF" 
     Direction="LeftToRight" HorizontalAlign="Left"> 

    <img alt="asd" src="Pictures/view.gif" id="AS" style="z-index: 1; left:100px; top:100px; position: relative"/> 'BIG IMAGE' 
    <img alt="move left" src="" id="moveleft" onclick="javascript:moveObjRight('AS');" 
     style="z-index: 1; left: 222px; top: 264px; position: absolute; height: 33px; width: 34px;"/> 
    </asp:Panel> 

</form> 
</body> 
</html> 

回答

0

將樣式overflow:hidden;添加到面板。