Most recent blog/article entries

Mar 20

Written by: Tim Thomas
20/03/2008

 

Stop the Username field of the DNN login control focusing

 

We've just finished another DNN website, www.alliedinsurancegroup.co.nz. The website has an account login module on the homepage.  By default, the Username field of this module takes the focus on page load.  This was a problem for this sites homepage since the account login module was quite low down on the page.

When the page was loading, the username field was taking focus, and hence the page was scrolling to the bottom.  Not a good look!  Here's how I quickly fixed this issue; I simply added this to the bottom of my Skin ascx file for this site - thanks to Keith for the update (mentioned in comments section):

<script language="javascript" type="text/javascript">
    window.onload = document.location='#';
</script>

I guess you could add this code to a text/html module, but didn't really want a similar thing happening on other pages either.

Hope this helps someone else.

Cheers,

Tim,

 

Tags:

3 comments so far...

Re: DotNetNuke (DNN) Login control takes focus on page load

I have the same problem and tried the solution but It doesn't seem to work when i use IE 7. i went to your site and it didn't work . Seems to woork fine in FF.

By ed on   29/06/2008

Re: DotNetNuke (DNN) Login control takes focus on page load

Here's a way to do this in all browsers:

window.onload = document.location='#';

By Keith Adler on   1/09/2008

Re: DotNetNuke (DNN) Login control takes focus on page load

Great, thanks Keith!Note, this needs to appear toward the bottom of the page. When i added it to the head tag area (in page settings) nothing happened. When put in a text/html module at the bottom of the page it worked a treat. I've updated this blog post to reflect your suggestion.

By Tim on   2/09/2008

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  

Opening quotesI’ve been in the communications industry for 10 years and worked with several web development providers. NetPotential is the best provider that I have encountered.Closing quotes

Internal Communications Manager
OneForTheGirls.org.nz
Auckland District Health Board

Blog archive by month

Exclamation Mark

Site Map

Hosting Services

Geek Speak

Portfolio

Client List

About Us

FAQ's
Careers

Contact Us