I have a web site that uses the following JavaScript to hide <div> sections: - <script type="text/javascript">
-
function showMe (it, box) {
-
var vis = (box.checked) ? "block" : "none";
-
document.getElementById(it).style.display = vis;
-
}
-
</script>
-
I have a checkbox to hide the <div> when checked:
[HTML]<input type="checkbox" name="multi_not e" value="Yes" onclick="showMe ('div1', this)">
[/HTML]
This works great if I load the page without the checkbox being checked. When I check the box, the <div1> appears. But I need the checkbox to be checked when the person first visits the site, and when they click OFF the checkbox, it needs to hide <div1>.
I know that it is probably simple, but I can't seem to figure it out...
Thanks - Tony
5 4896
I have a web site that uses the following JavaScript to hide <div> sections: -
function showMe (it, box) {
-
var vis = (box.checked) ? "block" : "none";
-
document.getElementById(it).style.display = vis;
-
}
-
I have a checkbox to hide the <div> when checked: -
<input type="checkbox" name="multi_note" value="Yes" onclick="showMe('div1', this)">
-
This works great if I load the page without the checkbox being checked. When I check the box, the <div1> appears. But I need the checkbox to be checked when the person first visits the site, and when they click OFF the checkbox, it needs to hide <div1>.
I know that it is probably simple, but I can't seem to figure it out...
Thanks - Tony
Use code Tags while you do post some codes.
Simply have this :-) -
<input type="checkbox" name="multi_note" value="Yes" onclick="showMe('div1', this)" checked>
-
Kind regards,
Dmjpro.
I have already tried adding the checked tag, as in:
<input type="checkbox" name="multi_not e" value="Yes" onclick="showMe ('div1', this)" checked>
and when I load the page, it shows that the checkbox is checked, but the <div1> is hidden. I need for the checkbox to be checked and for the <div1> to be visible.
When they uncheck the checkbox, then the <div1> will be hidden.
Thanks - Tony
acoder 16,027
Recognized Expert Moderator MVP
In your div, just add a style of display set to 'block':
[HTML]<div id="div1" style="display: block;">[/HTML]
THANKS!!! That worked!
Tony
acoder 16,027
Recognized Expert Moderator MVP
Glad to hear you got it working. Post again if you any more questions.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: F. Da Costa |
last post by:
Hi,
I' looking to retrieve ProdName1 form the <tr> below.
<tr id="1-1-1" class="even">
<td>
<div class="tier4">
<a href="#" class="leaf"></a>
ProdName1
</div>
|
by: benzwt |
last post by:
I use the following function to hide a <div> named one.
function hideObject() {
if (ns4) {
document.n1.visibility = "hide";
}
else if (ie4) {
document.all.style.visibility = "hidden";
}
else if (nn6) {
|
by: MOHSEN KASHANI |
last post by:
Hi,
I am trying to hide some form elements in a form by default and show/hide
depending on which radio button is clicked. This is what I have but it is
not working:
<head>
<style>
..noshow {
display: none;
}
|
by: Ruskin Hardie |
last post by:
There is an iframe in my document that is hidden, which is the target for a
submitted form. When the form is submitted, some javascript sets a hidden
div, to displaying, eg:
document.getElementById('hiddendiv').style.display = '';
This div, simply has the words "building csv file, please wait", and is
used, because their is no indication...
|
by: cargo303 |
last post by:
I have a php page with a drop down list, and the default selected
option is "Select a location" (without quotes).
Using the drop down initiates a database query. One of (3) things
should happen:
1. If an option is selected for which results are available, they
should be displayed on the same page beneath the drop down list in a
table....
| |
by: shivendravikramsingh |
last post by:
hello friend,i m using this code<div id="get" style="visibility:hidden"><? include "time_title.php" ?></div> in a php page,i want when page load the inclued page time_tiltle.php should not shown,when i click a button,it should appear.but i don't no wat.s the prob. when i open the page it showing the content of timr_title.php,the <div> visibility...
|
by: widevision7 |
last post by:
I have a web page that uses the following JavaScript to hide a <div> unless the checkbox is checked:
<script type="text/javascript">
function showMe (it, box) {
var vis = (box.checked) ? "block" : "none\
document.getElementById(it).style.display = vis;
}
I need to have it where if the box is not checked with 10 seconds, then a <meta...
|
by: Window Frog |
last post by:
Hello all, I am going to be utilizing a <divon a site that is shown
and hidden w/ the click of a button. I can already do this, but when
the button is clicked the <divis show quite rapidly. I'd like to
slow the opening/showing process with something emulating a motion
tween. Apple uses something like this in their menus on their website.
Any...
|
by: prino |
last post by:
Hi all,
I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |