Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jumps to top of page when javascript is used
Old 07-05-2010, 03:54 PM jumps to top of page when javascript is used
Extreme Talker

Posts: 176
Trades: 0
http://linkpagecentral.com/newskeddl...dles/index.php

Makin' a blog

I have the categories on the right, and when you click plus it unhides a div with all the posts in that section

here's the code
Code:
function toggle(id) {
	        var state = document.getElementById(id).style.display;
	            if (state == 'block') {
	                document.getElementById(id).style.display = 'none';
					document.getElementById(id+'toggle').innerHTML = '[+]';
	            } else {
	                document.getElementById(id).style.display = 'block';
					document.getElementById(id+'toggle').innerHTML = '[-]';
	            }
	        }
its very basic since I don't know much, but was wondering why when you click a plus sign the browser jumps(scrolls) to the top of the page
any quick fixes?
Skeddles is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-05-2010, 04:03 PM Re: jumps to top of page when javascript is used
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
because the href goes to "#"
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-05-2010, 06:33 PM Re: jumps to top of page when javascript is used
Extreme Talker

Posts: 176
Trades: 0
Quote:
Originally Posted by chrishirst View Post
because the href goes to "#"
but if I don't have that it just refreshes the page
Skeddles is offline
Reply With Quote
View Public Profile
 
Old 07-06-2010, 05:00 AM Re: jumps to top of page when javascript is used
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
leave out the href attribute completely
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to jumps to top of page when javascript is used
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13573 seconds with 12 queries