JLongo3925 Posted April 29, 2009 Report Share Posted April 29, 2009 I am new to programming and do not know what I can and can not do with certain languages. How can I create decisions on the fly? Would I use Javascript? For instance, if a radio button is selected and the value equals "sometext", then display a text field. Otherwise, do not display a text field. Using pseudo-code, would this work or something similar to this? function sampleFunction() { if ($someVariable ==true) { document.write[]; } } Quote Link to comment Share on other sites More sharing options...
BeeDev Posted May 7, 2009 Report Share Posted May 7, 2009 You do not create decisions on the fly. You pre-create the possible conditions that the user may choose. What you want to do there is quite advanced and I think you should have few basic tutorials in Javascript first. But to elaborate and expand on your idea, writing or other HTML elements using Javascript is not really recommended. What you should do is have a script that can hide/show or block elements. Then place the inputs in the block elements and set their style to display:none. Then you can start using the events (onClick, onFocus, onBlur etc) to fire/initiate functions: Above is not tested, however it's just a basic idea of how you would write your code. However if you use "JQuery" javascript library, it will make your life 100% easier Quote Link to comment Share on other sites More sharing options...
BeeDev Posted May 7, 2009 Report Share Posted May 7, 2009 Nice tutorial and info about radio buttons here: http://www.somacon.com/p143.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.