2011-01-27 14 views
-1

可能性のある重複した後、文書の末尾から要素を移動:
Position an element from the end of the document at the top of the pageJavaScriptを - ちょうど<body>

こんにちは

<div id="debug"> 
    blabla 
    </div> 
</body> 

どのように私は#デバッグを移動することができますdivの後に、文書の冒頭で、<body>の後、javascriptのみを使用しますか?

+2

なぜ重複を投稿?投稿はいつでも編集できます(http://stackoverflow.com/questions/4814007/css-position-a-element-from-the-end-of-the-document-at-the-top-of-the-page/4814027#4814027)より多くの情報を提供しますか? – Chandu

+0

私は最初にCSSとしてマークされているので、人々はそれを無視すると思った:) – Alex

+0

タグを変更することができます。実際、私はそれをやります。 –

答えて

1

JavaScriptやjQueryの? jQueryの使用時には:

$('body').append($('#debug')); 
+2

それは最後までそれを補う。 – ThiefMaster

1
var element = document.getElementById('debug'); 
document.body.insertBefore(element, document.body.firstChild); 
関連する問題