[Javascript] Image over textarea

Dan Costea costea.dan at ssi-schaefer.ro
Tue Jan 29 01:01:48 CST 2002


This is possible. The div  object can be displayed over a textarea. The
problems are with div over a select-one object (combobox) or select-multiple
object (for these kind of objects you can use a popup object - the only one
that can be displayed over them).

DIV over textarea:

<body>
<div style="position:absolute; top:0; left:0;"><img src='img.jpg'></div>
<TEXTAREA id="asdf" ROWS=7 COLS=40>this is a textarea ...</TEXTAREA>
</body>

if you don't know the position of the textarea, you can find it with the
following functions:

function findPosX(obj)
{
 var curleft = 0;
 if (document.getElementById || document.all)
 {
  while (obj.offsetParent)
  {
   curleft += obj.offsetLeft
   obj = obj.offsetParent;
  }
 }
 else if (document.layers)
  curleft += obj.x;
 return curleft;
}

function findPosY(obj)
{
 var curtop = 0;
 if (document.getElementById || document.all)
 {
  while (obj.offsetParent)
  {
   curtop += obj.offsetTop
   obj = obj.offsetParent;
  }
 }
 else if (document.layers)
  curtop += obj.y;
 return curtop;
}



----- Original Message -----
From: Ales Loncar
To: javascript at LaTech.edu
Sent: 28 January, 2002 2:58 PM
Subject: [Javascript] Image over textarea


Hi!

I'am working on CM (ASP + Jscript), after uploading image on server I would
like to show it over left, top corner of textarea. Is this possible (
ilayer, div ..)?

Tnx for answer.

LP, AlesL




More information about the Javascript mailing list