Jump to content
Killersites Forums

Quick pointer


Recommended Posts

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?

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...