[thelist] Javascript Help

Michael Robertson mike at mikeemedia.com
Sat Oct 25 19:08:15 CDT 2003


i'm using this block of code in an ASP page to show a make a hidden layer visible and pass it some variables. When I do it makes it visible but completely erases the rest of the page and ignores any CSS. What am i doing wrong? I also get an error that says ShowIt not defined. Thanks in advance.


calling function like so:

<div><a class=""edit"" href=""javascript:;"" onclick=""DoIt('EditBox','" & dMonthDay & "','" & EventTile & "','" & arEvents(3, iIndex) & "')"">edit steps</a></div>

css:
 .Box{
  position:absolute;
  top:70px;
  left:330px;
  width:250px;
  height:auto;
  border:2px solid #56428b;
  background-color:white;
  padding:6px;
  visibility:hidden;
  text-align:center;
  z-index:112;
 }

js:
<script language="JavaScript" type="text/JavaScript">

 function ShowIt(theLayer) {
  if(document.layers)              
   {document.layers[theLayer].visibility = "show";}    
  else if(document.getElementById)           
   {document.getElementById(theLayer).style.visibility = "visible";}
  else                
   {document.all[theLayer].style.visibility = "visible";} 
 } 
 
 function HideIt(theLayer) {
  if(document.layers)            
   document.layers[theLayer].visibility = "hide";   
  else if(document.getElementById)         
   document.getElementById(theLayer).style.visibility = "hidden";
  else                
   document.all[theLayer].style.visibility = "hidden";  
 }
 
 function DoIt(theLayer,theDate,theSteps,theNotes) {
  WriteBox(theDate,theSteps,theNotes);
  ShowIt(theLayer);
 } 
 
 function WriteBox(theDate,theSteps,theNotes) {
  document.write("<div id=\"EditBox\" class=\"Box\">");
  document.write("<form method=\"Post\" action=\"ProcessModSteps.asp\">");
  document.write(theDate + "<br/>");
  document.write("Current Steps<br/>");
  document.write("<input type=\"text\" name=\"Steps\" value=\"" + theSteps + "\">");
  document.write("<br/>");
  document.write("Notes<br>");
  document.write("<textarea></textarea>");
  document.write("<br/>");
  document.write("<input type=\"submit\" value=\"Change\">");
  document.write("<br />");
  document.write("<input type=\"button\" value=\"Cancel\" onClick=\"HideIt('EditBox')\">"); 
  document.write("</form>");
  document.write("</div>");
 }

</script>


More information about the thelist mailing list