javascript - Hidden div flashing on page load -
In my rail app, I am trying to hide a div (box) on the page load in the Javascript function. This function gives the end through a series of checkboxes with the same name (CB) if any checkbox is checked, then it should be shown div.
function boxcack (CB, box) {var cbs = document.getElementsByName (cb); Var d = document.getElementById (box); D.style.display = 'none'; Var flag_check = 0 (var zxc0 = 0; zxc0 & lt; cbs.length; zxc0 ++) {if (CBS [zxc0] is checked) {flag_check = flag_check + 1} and {}} if ( Flag_check> 0) {d Style.display = 'block'; Document.getElementById ('multi_control_spacer'). Style.display = 'block'; } And {d.style.display = 'none'; Document.getElementById ('multi_control_spacer'). Style.display = 'none'; }}
A fire starts with this task:
& lt; Body onload = "javascript: boxcheck ('doc_ids []', 'mult_control');" & gt;
The problem is that when a checkbox is not selected, the div flashes on time, and then disappears.
Here is the CSS:
#Multi Control {Padding: 10px; Background: # 333; }
I tried to set CSS to display: None, but then I can not seem to switch it back to the display: Block with Javascript < / P>
Why not? You have tried:
element.style.display = 'block';
How can I begin to type style = "display: none" in the development tag?
Comments
Post a Comment