April 18, 2012
DIV Style and DIV Position not getting along
Question by user1186164
<div id=mmactivate style='display: none'>
<form>
<INPUT TYPE="text" NAME="date1xx" VALUE="" SIZE=25>
<IMG SRC=CalandarIcon.png HREF="#" onClick="cal1xx.select(document.forms[0].date1xx,'anchor1xx','MM/dd/yyyy'); return false;" TITLE="cal1xx.select(document.forms[0].date1xx,'anchor1xx','MM/dd/yyyy'); return false;" NAME="anchor1xx" ID="anchor1xx">
<DIV ID="testdiv1" STYLE="position:absolute;background-color:white;layer-background-color:white;"></DIV>
</form>
</div>
This code is used to activate a popup java calandar. For some reason the style=’display: none’ and the position:absolute; arn’t playing along. If I delete one or the other it works, otherwise it does nothing when I click it…
Any ideas on how to make it work?
Answer by Starx
So many mistakes
- Java is not JavaScript. [MetalFrog]
- Line 1:
id=mmactivate
should beid="mmactivate"
- Line 2: The form consists of no method, actions or enctype. [Mr. Lister]
- Line 4: Why is there script in the
title
field? - Line 4: Why does an image have a
href
attribute. [Mr. Lister] - Line 4: Inline event handlers are a bad choice to start with.
- Line 5:
testdiv1
is a child of “mmactivate”, so it has to follow its parent’sdisplay: none;