asp checkbox
-
i want to add text to an asp page when the check box is ticked how do i go about this? thanks
-
i want to add text to an asp page when the check box is ticked how do i go about this? thanks
Well - there are a number of ways to do this, depending on what kind of text you want added - that is, if it is dynamic or static text. Basically - you could do a postback when the checkbox is checked, and then add the text when creating the page again. If the text is more static, then perhaps you could actually create the text, but make it "hide" it, then show it via JavaScript when the box is checked or simply adding it via JavaScript. But again, the "best" approch is depending on what text you wish to add and how/when it show be displayed. --------------------------- 127.0.0.1 - Sweet 127.0.0.1
-
Well - there are a number of ways to do this, depending on what kind of text you want added - that is, if it is dynamic or static text. Basically - you could do a postback when the checkbox is checked, and then add the text when creating the page again. If the text is more static, then perhaps you could actually create the text, but make it "hide" it, then show it via JavaScript when the box is checked or simply adding it via JavaScript. But again, the "best" approch is depending on what text you wish to add and how/when it show be displayed. --------------------------- 127.0.0.1 - Sweet 127.0.0.1
could some one post some code to get me started please sorry but im new to this development thanks in advance
-
could some one post some code to get me started please sorry but im new to this development thanks in advance
Well - as I said, it depends on what kind of text you wish to display. If it is static text (doesn't change much/at all) or dynamic text (changes depending on various things). If it is static text that doesn't change (much) after the page creation, then I'd simply write the text when you create the page the first time and place the styles visibility:hidden;display:none on the container in which you place the text (div tag or what not). This will hide the text from the user (still viewable in "view source" though) Then on the checkbox make a call to a JavaScript "onChange" (I think it is the onChange event - look up the JavaScript events tied to a checkbox to confirm) which then alters the styles of the container. This is perhaps a little tricky unless you have worked with JavaScript before. Alternative and perhaps easier, you could simply resubmit the form when it gets checked. Depending on if you use asp.net or asp, then there are ways to do this. Ordinary asp requiers you to use JavaScript as well, if I recall correct. And then generate the new page with the new text. You just need the form to submit/postback and then test if it is postback, and then add the text while generating the page. But this is relative basic stuff, so if you don't know how to do these things, I'd advice you to find some online beginner ressources (simply do a search on a searchengine) and then start reading up on the programming involved, then it all should fall into place :) --------------------------- 127.0.0.1 - Sweet 127.0.0.1