Closed Bug 294337 Opened 20 years ago Closed 20 years ago

Javascript changing 'display' scrolls page

Categories

(SeaMonkey :: General, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: viraptor, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511

On this page javascript is changing 'display' attribute between 'block' and
'none'. Change block->none works good, but after changing none->block page
scrolls down.
Function changeDisplay() - it's activated after clicking on horizontal bar with
3 dots.

Reproducible: Always

Steps to Reproduce:
1. Scroll page to the begining.
2. Click the bar to hide the div block.
3. Clock the bar to show it again.

Actual Results:  
Page is scrolled to bottom.

Expected Results:  
Leave scroll position in the same place as it was before the change.
This happens because it is a link that points to an anchor in the same page.
You can prevent this from happening by using this:
<a href="#newsy" onclick="changeDisplay(event)"><img
src="news_files/belka-srodek.gif" alt="" height="16" width="750"></a>

 and this as function:
    function changeDisplay(e) { var newsy = document.getElementById('newsy');
newsy.style.display = (newsy.style.display == 'block')? 'none': 'block';
e.preventDefault(); }
Ok. So it's just an error in document... bug is invalid.
Exactly, so marking as such.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.