homepage Welcome to WebmasterWorld Guest from 54.226.43.155
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
show/hide div only once
no loop
eSite




msg:3080813
 11:07 pm on Sep 12, 2006 (gmt 0)

Hi,

I would like a div (for live comment preview) to be hidden by default, and show on focus of the comment form - that's all.

Notice : If it shows onfocus and hides onblur it's very annoying and if I go to another window the behavior can even be reversed (onfocus = hide).

 

RonPK




msg:3081503
 2:34 pm on Sep 13, 2006 (gmt 0)

Forms don't have an onfocus event. Maybe you can attach it to the first input field?

<input type="text"  
onfocus="document.getElementById('myDiv').syle.display='block';">

eSite




msg:3082410
 4:22 am on Sep 14, 2006 (gmt 0)

I can't have it to work.

<style type="text/css">
#show_hide{display:none;}
</style>

<div id="show_hide">
ok
</div>

<input type="text" onfocus="document.getElementById('show_hide').syle.display='block';">

eSite




msg:3082417
 4:32 am on Sep 14, 2006 (gmt 0)

Ah, it's because of your typo.
Well thanks anyway, was easier than I thought, I should learn JS.

Edouard_H




msg:3082418
 4:32 am on Sep 14, 2006 (gmt 0)

May just be the misspelled style. Add the 't' to 'syle' and it should work.

RonPK




msg:3082469
 5:38 am on Sep 14, 2006 (gmt 0)

Oops, sorry for he ypo ;)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved