RE: JS and Radio Button Issue
I think what you have here is simply Prototype - you should not require jquery. -Original Message- From: Kevan Stannard [mailto:[EMAIL PROTECTED] Sent: 10 January 2007 09:27 To: CF-Talk Subject: RE: JS and Radio Button Issue Hi Bruce, Something that you might want to look at is either the Prototype or jQuery (www.jquery.com) javascript libraries. They are just amazing in how they can manipulate a page. They are cross browser compatible too. For example, using jQuery you would write your code as follows (may not be exactly right (I am still learning) but will give you the idea) Just include the jquery-latest.js file at the top of your page. function toggle(divToShow) { if (divToShow == "with") { $("#withdiv").show(); $("#withoutdiv").hide(); } else { $("#withdiv").hide(); $("#withoutdiv").show(); } } With jQuery it helps to know a little CSS as the same syntax is used for selecting page elements. Best regards Kevan -Original Message- From: Bruce Sorge [mailto:[EMAIL PROTECTED] Sent: Wednesday, 10 January 2007 3:05 PM To: CF-Talk Subject: RE: JS and Radio Button Issue Thanks Charlie. That did it. -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 09, 2007 4:20 PM To: CF-Talk Subject: Re: JS and Radio Button Issue few things i can see would be a problem. you have multiple elements with ids "with" and "without" (the radio buttons and the divs). the code below should work. function toggle(divToShow) { if (document.getElementById) { if (divToShow == "with") { document.getElementById('withdiv').style.display = "inline"; document.getElementById('withoutdiv').style.display = "none"; } else { document.getElementById('withdiv').style.display = "none"; document.getElementById('withoutdiv').style.display = "inline"; } } } With Without With vote by mail options here without vote by mail options here On 1/9/07, Bruce Sorge <[EMAIL PROTECTED]> wrote: > I have a form that has two radio buttons. Their function is to show one of > two hidden divs. > The JS is this: > > function toggle('with', 'without') > { > if (document.getElementById) { > withvbm= document.getElementById('with'); > withoutvbm= document.getElementById('without'); > } > > if (withvbm.style.display == "none"){ > withvbm.style.display = ""; > withoutvbm.style.display = "none"; > } > > else if (withoutvbm.style.display == "none"){ > withoutvbm.style.display = ""; > withvbm.style.display = "none"; > } > } > > The radio buttons look like this: > With > onclick="toggle('without', 'with')">With Out > > And the divs look like this: > > With vote by mail options here > > > without vote by mail options here > > When I click either button, I get an error that and Object is expected. The > error is on the radio buttons. From what I can tell everything looks OK. Can > anyone see any issues with this? Also, I tried changing the first div's > style to display:block assuming that the page needed to see one of them and > of it did not work, but then I though no, that cannot be it since I want > both div's hidden until the user clicks one of the buttons. > > Thanks, > -- > Bruce Sorge > > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266112 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: JS and Radio Button Issue
Hi Bruce, Something that you might want to look at is either the Prototype or jQuery (www.jquery.com) javascript libraries. They are just amazing in how they can manipulate a page. They are cross browser compatible too. For example, using jQuery you would write your code as follows (may not be exactly right (I am still learning) but will give you the idea) Just include the jquery-latest.js file at the top of your page. function toggle(divToShow) { if (divToShow == "with") { $("#withdiv").show(); $("#withoutdiv").hide(); } else { $("#withdiv").hide(); $("#withoutdiv").show(); } } With jQuery it helps to know a little CSS as the same syntax is used for selecting page elements. Best regards Kevan -Original Message- From: Bruce Sorge [mailto:[EMAIL PROTECTED] Sent: Wednesday, 10 January 2007 3:05 PM To: CF-Talk Subject: RE: JS and Radio Button Issue Thanks Charlie. That did it. -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 09, 2007 4:20 PM To: CF-Talk Subject: Re: JS and Radio Button Issue few things i can see would be a problem. you have multiple elements with ids "with" and "without" (the radio buttons and the divs). the code below should work. function toggle(divToShow) { if (document.getElementById) { if (divToShow == "with") { document.getElementById('withdiv').style.display = "inline"; document.getElementById('withoutdiv').style.display = "none"; } else { document.getElementById('withdiv').style.display = "none"; document.getElementById('withoutdiv').style.display = "inline"; } } } With Without With vote by mail options here without vote by mail options here On 1/9/07, Bruce Sorge <[EMAIL PROTECTED]> wrote: > I have a form that has two radio buttons. Their function is to show one of > two hidden divs. > The JS is this: > > function toggle('with', 'without') > { > if (document.getElementById) { > withvbm= document.getElementById('with'); > withoutvbm= document.getElementById('without'); > } > > if (withvbm.style.display == "none"){ > withvbm.style.display = ""; > withoutvbm.style.display = "none"; > } > > else if (withoutvbm.style.display == "none"){ > withoutvbm.style.display = ""; > withvbm.style.display = "none"; > } > } > > The radio buttons look like this: > With > onclick="toggle('without', 'with')">With Out > > And the divs look like this: > > With vote by mail options here > > > without vote by mail options here > > When I click either button, I get an error that and Object is expected. The > error is on the radio buttons. From what I can tell everything looks OK. Can > anyone see any issues with this? Also, I tried changing the first div's > style to display:block assuming that the page needed to see one of them and > of it did not work, but then I though no, that cannot be it since I want > both div's hidden until the user clicks one of the buttons. > > Thanks, > -- > Bruce Sorge > > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266111 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: JS and Radio Button Issue
Indeed, by their very nature you should not have dupe ids on a page. "This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions." Visit our website at http://www.reedexpo.com -Original Message- From: Charlie Griefer To: CF-Talk Sent: Wed Jan 10 00:19:47 2007 Subject: Re: JS and Radio Button Issue few things i can see would be a problem. you have multiple elements with ids "with" and "without" (the radio buttons and the divs). the code below should work. function toggle(divToShow) { if (document.getElementById) { if (divToShow == "with") { document.getElementById('withdiv').style.display = "inline"; document.getElementById('withoutdiv').style.display = "none"; } else { document.getElementById('withdiv').style.display = "none"; document.getElementById('withoutdiv').style.display = "inline"; } } } With Without With vote by mail options here without vote by mail options here On 1/9/07, Bruce Sorge <[EMAIL PROTECTED]> wrote: > I have a form that has two radio buttons. Their function is to show one of > two hidden divs. > The JS is this: > > function toggle('with', 'without') > { > if (document.getElementById) { > withvbm= document.getElementById('with'); > withoutvbm= document.getElementById('without'); > } > > if (withvbm.style.display == "none"){ > withvbm.style.display = ""; > withoutvbm.style.display = "none"; > } > > else if (withoutvbm.style.display == "none"){ > withoutvbm.style.display = ""; > withvbm.style.display = "none"; > } > } > > The radio buttons look like this: > With > onclick="toggle('without', 'with')">With Out > > And the divs look like this: > > With vote by mail options here > > > without vote by mail options here > > When I click either button, I get an error that and Object is expected. The > error is on the radio buttons. From what I can tell everything looks OK. Can > anyone see any issues with this? Also, I tried changing the first div's > style to display:block assuming that the page needed to see one of them and > of it did not work, but then I though no, that cannot be it since I want > both div's hidden until the user clicks one of the buttons. > > Thanks, > -- > Bruce Sorge > > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266109 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: JS and Radio Button Issue
Thanks Charlie. That did it. -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 09, 2007 4:20 PM To: CF-Talk Subject: Re: JS and Radio Button Issue few things i can see would be a problem. you have multiple elements with ids "with" and "without" (the radio buttons and the divs). the code below should work. function toggle(divToShow) { if (document.getElementById) { if (divToShow == "with") { document.getElementById('withdiv').style.display = "inline"; document.getElementById('withoutdiv').style.display = "none"; } else { document.getElementById('withdiv').style.display = "none"; document.getElementById('withoutdiv').style.display = "inline"; } } } With Without With vote by mail options here without vote by mail options here On 1/9/07, Bruce Sorge <[EMAIL PROTECTED]> wrote: > I have a form that has two radio buttons. Their function is to show one of > two hidden divs. > The JS is this: > > function toggle('with', 'without') > { > if (document.getElementById) { > withvbm= document.getElementById('with'); > withoutvbm= document.getElementById('without'); > } > > if (withvbm.style.display == "none"){ > withvbm.style.display = ""; > withoutvbm.style.display = "none"; > } > > else if (withoutvbm.style.display == "none"){ > withoutvbm.style.display = ""; > withvbm.style.display = "none"; > } > } > > The radio buttons look like this: > With > onclick="toggle('without', 'with')">With Out > > And the divs look like this: > > With vote by mail options here > > > without vote by mail options here > > When I click either button, I get an error that and Object is expected. The > error is on the radio buttons. From what I can tell everything looks OK. Can > anyone see any issues with this? Also, I tried changing the first div's > style to display:block assuming that the page needed to see one of them and > of it did not work, but then I though no, that cannot be it since I want > both div's hidden until the user clicks one of the buttons. > > Thanks, > -- > Bruce Sorge > > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266107 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: JS and Radio Button Issue
few things i can see would be a problem. you have multiple elements with ids "with" and "without" (the radio buttons and the divs). the code below should work. function toggle(divToShow) { if (document.getElementById) { if (divToShow == "with") { document.getElementById('withdiv').style.display = "inline"; document.getElementById('withoutdiv').style.display = "none"; } else { document.getElementById('withdiv').style.display = "none"; document.getElementById('withoutdiv').style.display = "inline"; } } } With Without With vote by mail options here without vote by mail options here On 1/9/07, Bruce Sorge <[EMAIL PROTECTED]> wrote: > I have a form that has two radio buttons. Their function is to show one of > two hidden divs. > The JS is this: > > function toggle('with', 'without') > { > if (document.getElementById) { > withvbm= document.getElementById('with'); > withoutvbm= document.getElementById('without'); > } > > if (withvbm.style.display == "none"){ > withvbm.style.display = ""; > withoutvbm.style.display = "none"; > } > > else if (withoutvbm.style.display == "none"){ > withoutvbm.style.display = ""; > withvbm.style.display = "none"; > } > } > > The radio buttons look like this: > With > onclick="toggle('without', 'with')">With Out > > And the divs look like this: > > With vote by mail options here > > > without vote by mail options here > > When I click either button, I get an error that and Object is expected. The > error is on the radio buttons. From what I can tell everything looks OK. Can > anyone see any issues with this? Also, I tried changing the first div's > style to display:block assuming that the page needed to see one of them and > of it did not work, but then I though no, that cannot be it since I want > both div's hidden until the user clicks one of the buttons. > > Thanks, > -- > Bruce Sorge > > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266103 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
JS and Radio Button Issue
I have a form that has two radio buttons. Their function is to show one of two hidden divs. The JS is this: function toggle('with', 'without') { if (document.getElementById) { withvbm= document.getElementById('with'); withoutvbm= document.getElementById('without'); } if (withvbm.style.display == "none"){ withvbm.style.display = ""; withoutvbm.style.display = "none"; } else if (withoutvbm.style.display == "none"){ withoutvbm.style.display = ""; withvbm.style.display = "none"; } } The radio buttons look like this: With With Out And the divs look like this: With vote by mail options here without vote by mail options here When I click either button, I get an error that and Object is expected. The error is on the radio buttons. From what I can tell everything looks OK. Can anyone see any issues with this? Also, I tried changing the first div's style to display:block assuming that the page needed to see one of them and of it did not work, but then I though no, that cannot be it since I want both div's hidden until the user clicks one of the buttons. Thanks, -- Bruce Sorge ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266102 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4