yukabuk said:
I think what shes trying to explain
.... which you have not quoted at all, despite e.g. the FAQ recommending
otherwise ...
is have a hidden div containing results which then displays after the user
clicks on the 'Add' link.
Aditya, try this...
<div id='results' style='display:none;'>
...
All your html results in a table
...
</div>
<button
onmouseup='document.getElementById("results").style.display="inline";'>Add</
button>
There are several fundamental problems with this approach:
1. The `div' element is not displayed if CSS is supported, support is
enabled, and client-side script support is not present, is disabled,
or is insufficient.
2. The `button' element requires HTML 4.01, while a more compatible
<input type="button" value="Add"
onmouseup="document.getElementById('results').style.display='inline';">
would have sufficed here as the caption is only text.
3. The button will not work without client-side scripting. As it is not
written with client-side scripting, when support is insufficient users
encounter a control that is apparently not working. A Bad Thing.
4. If client-side scripting is enabled, the button will also be activated
if one clicks elsewhere and only releases the mouse button over the
button because that is the definition of the `mouseup' event.
The button cannot be activated with the keyboard, only with a pointing
device. By not fulfilling this very basic criterion, the application
fails to meet standardized accessibility guidelines which are not only
desirable to meet but are often are required-by-law to meet in order
for the application to be even considered for public use or use within
a particular organization.
`onclick' is the proper event handler attribute to use here, not
`onmouseup'.
5. The button will not only not work but throw an exception if for some
reason sufficient DOM Level 1+ support is not available, as this support
is required by document.getElementById() and the method has been called
without prior feature test. This is the case e.g. in MSHTML 5.0, used
e.g. by Internet Explorer 5.0.
It will also error out if the method for some reason does not return an
object reference, as the return value is used untested in a reference
worm[tm]. The same goes for any other reference along the worm's path.
6. The `div' element is a block element, not an inline element; the
default value for its CSS `display' property is `block', not `inline'.
7. You are showing an infection with DIVitis: An additional `div' element
that the table is contained in is completely unnecessary; the table
itself can be hidden (but should only be hidden onload, with the
same scripting that later shows it):
<body onload="hideTable()">
8. Hiding the table does not prevent the whole table from being downloaded
and parsed although not needed/wanted, which can take quite long and is
probably not what the OP wants. ISTM they rather want the Add button to
display the entries that can be used to populate another table, for
which, as I said before, no client-side scripting is needed at all.
Considering these facts, I suggest you refrain from suggesting anything
further in this newsgroup, and to go back to the drawing board, if not your
student's books instead.
PointedEars