• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Javascript, one works but not the other.

Joined
Jul 24, 2009
Messages
476 (0.09/day)
System Name Corporate Commando
Processor Intel i7 3820 @ 4.5ghz
Motherboard Asrock x79 extreme 6gb
Cooling corsair h100
Memory 8 gig corsair 1866 ddr3 ram
Video Card(s) 3 x EVGA GTX 680
Storage 2x samsung F3 1tb drives in RAID 0, 512gb samsung ssd
Display(s) 3 x Asus 27" monitor @ 5760 x 1080
Case Corsair C70
Power Supply Coolermaster 1200watt gold
I am creating a web based form in html. Basically when the form loads the javascript has two drop down menus that are hidden. However, when the user checks a checkbox they become visible. The problem I am running into is that one of the checkboxes work perfect but the other check box doesn't. Below is snipets of the code.


script:
Code:
<script type="text/javascript">
function hiddenload(){
{
document.accountreqform.emailDrop.style.visibility="hidden";
}
{
document.accountreqform.inforDrop.style.visibility="hidden";
}
}
function inspectemailbox() {
if (document.accountreqform.EmailCheckBox.checked) {
document.accountreqform.emailDrop.style.visibility = 'visible'; 
}
if (document.accountreqform.EmailCheckBox.checked == false) {
document.accountreqform.emailDrop.style.visibility = 'hidden'; 
}
function inspectinforbox() {
if (document.accountreqform.InforCheckBox.checked) {
document.accountreqform.inforDrop.style.visibility = 'visible'; 
}
if (document.accountreqform.InforCheckBox.checked == false) {
document.accountreqform.inforDrop.style.visibility = 'hidden'; 
}
}
}
</script>

email check box
Code:
<input id="EmailCheckBox" name="EmailCheckBox[]" type="checkbox" value="eMail" onClick="inspectemailbox()">

email drop down
Code:
<select id="emailDrop" name="emailDrop">
removed due to info
                        </select>

infor check box
Code:
<input id="InforCheckBox" name="InforCheckBox[]" type="checkbox" value="Infor EAM Login" onClick="inspectinforbox()">

infor drop down
Code:
<select id="inforDrop" name="inforDrop">
removed due to info
                        </select>

Like I said the email check box works perfectly. However, when I click the infor check box it does not make the infor drop down menu visible.
 
Joined
May 21, 2009
Messages
4,966 (0.91/day)
System Name i7-PC / HTPC / iMac
Processor i7 3820 / Phenom II 940
Motherboard GIGABYTE G1.ASSASSIN2 / M3A79-T Deluxe
Cooling Corsair Hydro H100i / Scythe II (HS only)
Memory G.SKILL Trident X Series 8GB (2 x 4GB) DDR3 1600mhz / 4GB DDR2 1066 (@800) Corsair Dominator
Video Card(s) GB Radeon HD 7950s 3GB / GB Radeon HD 7950s 3GB
Storage 2x 80GB Intel X-25, 2x600gb SATA, 1x1tb 5400RPM storage /1x600GB, 3x500GB,1x160,1x120 SATA
Display(s) 1x 27" Yamakasi / Vizio 42" HDTV
Case Lian Li Lancool PC-K58 / Antec 900
Audio Device(s) HT Omega Striker 7.1 / Onboard and HDMI from ATi Card
Power Supply PC Power & Cooling 750W / 610W
Software Ubuntu / Windows 8.1 Pro / OS X / PHPStorm / Gaming
i'm looking through, not positive atm.

imo a much easier way would be to place them in divs, and set the divs to hidden via css. then just have onclick added to the checkbox that will set the div's visibility back.
 
Joined
Jul 24, 2009
Messages
476 (0.09/day)
System Name Corporate Commando
Processor Intel i7 3820 @ 4.5ghz
Motherboard Asrock x79 extreme 6gb
Cooling corsair h100
Memory 8 gig corsair 1866 ddr3 ram
Video Card(s) 3 x EVGA GTX 680
Storage 2x samsung F3 1tb drives in RAID 0, 512gb samsung ssd
Display(s) 3 x Asus 27" monitor @ 5760 x 1080
Case Corsair C70
Power Supply Coolermaster 1200watt gold
it had to do with the brackets. I changed each one to its own script and now it works. Thanks for your help digi
 
Top