2011-07-25 9 views
0
<a href="javascript:window.location.hash='today'; window.scrollTo(0,0);window.location.hash=''; document.getElementById('availability_view').scrollBy(300,0);"> 

ここで、availability_viewはHTMLDIVElementです。なぜdocument.getElementById( 'availability_view')。scrollBy(300,0)が機能しないのですか?

コンソールが返されます。

TypeError: '130' is not a function (evaluating 'document.getElementById('availability_view').scrollBy(300,0)') 

答えて

1

私は間違っていないよ場合は、scrollBy()は、ウィンドウの関数です。

divをスクロールする場合は、scrollToを使用します。

関連する問題