krillz Posted February 16, 2010 Report Share Posted February 16, 2010 So yeah javascript is not my cup of tea, but unfortunately I need it done as my javascript dude called in sick. Basically I got a form, and onfocus on the different input elements text should be displayed in a div that is found on the side. So logically I tried something a long these lines: function change() { document.getElementById('info').document.write("Test"); } and in the input tag added onFocus="change()" but yeah that didn't work, anyone that can point this thing out so I can continue? Quote Link to comment Share on other sites More sharing options...
krillz Posted February 16, 2010 Author Report Share Posted February 16, 2010 I solved it you can lock this thread. Solution if anyone is interested: function toggle(id) { var state = document.getElementById(id).style.display; if (state == 'block') { document.getElementById(id).style.display = 'none'; } else { document.getElementById(id).style.display = 'block'; } } I simply hold the text in a div already, in css set its display: none; to hide it. in the input element I use OnFocus => call the JS function making it appear, onBlur calling it again to make it hide. 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.