yami007 Posted July 23, 2009 Share Posted July 23, 2009 I wanna know how the new user knew about my web site, so i made a select button ==> by google, yahoo,friend,other so when they click other option, i want to display a hidden input.. i hope i explained it right, and hoping for your help again Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted July 24, 2009 Share Posted July 24, 2009 you can't show a literal 'hidden' input as far as i know. you can just toggle something with an input in it tho: <input type=radio name=how value=google onclick="show('g');">Google</input> <input type=radio name=how value=yahoo onclick="show('y');">Yahoo</input> <div style="display:none;" id="g"> Oh really? Google? Tell us more <textarea> </div> <div style="display:none;" id="y"> Oh really? Yahoo? Tell us more <textarea> </div> with js of: function show(which){ document.getElementById(which).style.display=block; }//end function that'll toggle the div display. You'll have to tweak it some to hide that div and show the others of course, if the user changes there mind. or you can disable the radio. either way. lemme know Quote Link to comment Share on other sites More sharing options...
yami007 Posted July 24, 2009 Author Share Posted July 24, 2009 oh man i tried it but it ddnt work, i copied the function into the <script></script> tag in the head, and i opened the file then when i click on google or yahoo it does not display anything Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted July 24, 2009 Share Posted July 24, 2009 you did: <script type="text/javascript"> function </script> ? gotta link to the page? also try the java console. lemme know Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted July 24, 2009 Share Posted July 24, 2009 Put quotes around the inputs' attributes in the HTML and the word 'block' in the JavaScript and try it again. Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted July 24, 2009 Share Posted July 24, 2009 oh snap i dropped the ball on the block tags. sorry bout that. if there are no quotes it is trying to set it to the value of the variable block. which doesnt exist.... so document.getElementById(which).style.display="block"; sorry good catch nightslyr Quote Link to comment Share on other sites More sharing options...
yami007 Posted July 27, 2009 Author Share Posted July 27, 2009 you did: <script type="text/javascript"> function </script> ? gotta link to the page? also try the java console. lemme know yes i did Quote Link to comment Share on other sites More sharing options...
yami007 Posted July 27, 2009 Author Share Posted July 27, 2009 ok thanks lemme try it 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.