Web Analytics Made Easy -
StatCounter How do I Disable changes to a <DIV> - CodingForum


No announcement yet.

How do I Disable changes to a <DIV>

  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I Disable changes to a <DIV>

    I'm trying to make a form printable, but no editable, but it has radio buttons and checkboxes that are modifiable. If I disable the entire <DIV> with <DIV disabled=disabled> then it's that crappy gray that isn't very appealing print quality.

    So I tried to disable the click even which worked in most cases, but no all

    <div id="pnPrintable" onclick="return false;">

    Any clicks within this block are ignored, but with radio buttons it will act like you clicked on of the group, so if a another radio button is checked, and you click a different one. Radio button number 2 isn't changed, but Radio button number one is deselected.

    Any suggestions on making a form print nicely, but not editable would be greatly appreciated.

  • #2
    I think event capturing would work:

    document.getElementById('theDIV').addEventListener('click', function (event) { event.stopPropagation(); event.preventDefault(); return false }, true);

    But of course, that only works in DOM2-compliant browsers. Anything Gecko-based works, such as NS6, NS7, K-meleon, Galeon, Beonex, or Mozilla...


    • #3
      Yeah this is for IE6, so if you or anyone else have anymore ideas I would appreciate it.


      • #4
        Well I found out that all I needed was the onclick part, and then since it was the printable page, none of the radio buttons needed to be apart of a group, so I just got rid of all the groups, and it worked, thanks for your help though