[Javascript] {Virus?}Please help me

Tult tult at dsp.com.vn
Mon May 3 02:13:00 CDT 2004


Hi!
I'm using asp.net to draw a rectangle on an image .jpg but rectangle display
behind of .jpg, please help me draw a rectangle front of image .jpg,
this is code i use to draw a rectangle.
thanks,





<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="WebApplication3.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
 <HEAD>
  <title>WebForm1</title>
  <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
  <meta name="CODE_LANGUAGE" Content="C#">
  <meta name="vs_defaultClientScript" content="JavaScript">
  <meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
  <SCRIPT language="JavaScript" src="dynlayer.js"></SCRIPT>
  <SCRIPT language="JavaScript" src="createdestroy.js"></SCRIPT>
  <SCRIPT language="JavaScript">


ns4 = (document.layers)? true:false

ie4 = (document.all)? true:false

function init() {
        createLayer('templateDiv',null,0,0,800,600,'','#C0C0C0');
        template = new DynLayer("templateDiv")
        template.hide();

        document.getElementById('ViewImage').onmousedown=doWork_mousedown
        document.getElementById('ViewImage').onmousemove=doWork_mousemove
        document.getElementById('ViewImage').onmouseup=doWork_mouseup
        //if (ns4) document.captureEvents(Event.MOUSEDOWN |
Event.MOUSEMOVE )//| Event.MOUSEUP

        dragActive = false

}

 clickx = ""
 clicky = ""

//*****************************************

function doWork_mousemove(e)
{
 var x = (ns4)? e.pageX : event.x
 var y = (ns4)? e.pageY : event.y+document.body.scrollTop

if(document.all){xpos=window.event.x+document.body.scrollLeft;ypos=window.ev
ent.y+document.body.scrollTop;}
 var img=document.getElementById('ViewImage');
 //document.body.appendChild(img);
 xx=xpos-img.offsetLeft-2;
 yy=ypos-img.offsetTop-2;

 //document.getElementById('TextBox2').value='x= '+xx+' | y ='+yy;
 if(dragActive)
 {
  template.clipInit()
  template.clipTo(clicky,x,y,clickx)
 }

}


function doWork_mouseup(e)
{
 var x = (ns4)? e.pageX : event.x
    var y = (ns4)? e.pageY : event.y+document.body.scrollTop

if(document.all){xpos=window.event.x+document.body.scrollLeft;ypos=window.ev
ent.y+document.body.scrollTop;}
 var img=document.getElementById('ViewImage');
 //document.body.appendChild(img);
 xx=xpos-img.offsetLeft-2;
 yy=ypos-img.offsetTop-2;
 //var numLayer = (x-clickx)
 template.clipInit()
 template.clipTo(0,0,0,0);

 dragActive = false

 document.Form1.submit();
}


function doWork_mousedown(e)
{
  if ((ns4 && e.which == 1) || ie4) {

  template.show();
  var x = (ns4)? e.pageX : event.x
  var y = (ns4)? e.pageY : event.y+document.body.scrollTop


if(document.all){xpos=window.event.x+document.body.scrollLeft;ypos=window.ev
ent.y+document.body.scrollTop;}
  var img=document.getElementById('ViewImage');

  xx=xpos-img.offsetLeft-2;
  yy=ypos-img.offsetTop-2;


  clickx = x
  clicky = y

  dragActive = true

  return false
     }
     else return true
}

  </SCRIPT>
 </HEAD>
 <BODY onload="init()" ms_positioning="GridLayout">
  <form id="Form1" method="post" runat="server">
   <asp:Image id="ViewImage" style="Z-INDEX: 101; LEFT: 521px; POSITION:
absolute; TOP: 85px"
    runat="server" Width="187px" Height="194px"></asp:Image>
  </form>
 </BODY>
</HTML>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file.rar
Type: application/x-rar-compressed
Size: 3514 bytes
Desc: not available
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20040503/0d2c4d54/attachment.bin>


More information about the Javascript mailing list