Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Layer Position

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
Is there a way to set the position of a layer based on a value in a database?
 
You can do it by a combination of ASP or JSP and DHTML this way :
Server side (exemple : ASP code)
Get your values in db and store them in hidden input tags.
Client side (exemple : Javascript code)
At loading of the page (body onload event), get the values of hidden fields to resize your DIV.

Here is an example
Code:
<HTML>
<HEAD>
<%
  Dim SQL, rs, heightVal, widthVal

  SQL = &quot;SELECT width, eight FROM sizeTable&quot;
  Set rs = Conn.execute (SQL)
  'Conn is a valid connexion to your db 
  'that you openned before
  if not rs.eof Then
    heightVal = rs.fields(&quot;eight&quot;)
    widthVal = rs.fields(&quot;width&quot;)
  End if
  rs.close
%>
<SCRIPT language=&quot;javascript&quot;>
  function init() {
    var o_Tmp = document.getElementById(&quot;hid_height&quot;);
    var h = o_Tmp.value;
    o_Tmp = document.getElementById(&quot;hid_width&quot;);
    var w = o_Tmp.value;
    o_Tmp = document.getElementById(&quot;div2Resize&quot;);
    o_Tmp.style.height = h + &quot;px&quot;
    o_Tmp.style.width = w + &quot;px&quot;
  }
</SCRIPT>
</HEAD>
<BODY onLoad=&quot;init()&quot;>
<Input type=&quot;hidden&quot; id=&quot;hid_height&quot; value=&quot;<%=heightVal%>&quot;/>
<Input type=&quot;hidden&quot; id=&quot;hid_width&quot; value=&quot;<%=widthVal%>&quot;/>
<DIV id=&quot;div2Resize&quot;> </div>
</BODY>
</HTML>
Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top