2016-06-17 37 views
-3

可以改變DIV位置像(絕對或CSS相對),但使用Java腳本我如何改變通過JavaScript的

代碼例如

<div id="podpis" margin-top="2"> 
     <div class="invoice-signature"> 
     <span><?=$xml->sanitize($invoice['Invoice']['user_name'])?></span><br/> 
     <span>First name and second name osoby uprawnionej do wystawiania faktury</span> 
     </div> 

     <div class="invoice-signature"> 
     <span><br/></span><br/> 
     <span>First name and second name</span> 
     </div> 

     <div clear="both"/> 
    </div> 

我想改變DIV id="podpis"的位置DIV位置。

謝謝你的回答!

+0

爲什麼downvotes?這絕對是一個示例問題。他清楚地說明了自己正在嘗試做什麼('我想改變'div id =「podpis」'''的位置),並提供了示例代碼,以便我們知道我們正在看什麼。不知道那裏出了什麼問題。 – MineAndCraft12

回答

0

要設置位置值:

document.getElementById('podpis').style.position = 'relative'; 

document.getElementById('podpis').style.position = 'absolute'; 

並可根據您的評論聽起來像你對我想有podpis留在頁面不管底部什麼?

//div stays in same place on screen no matter what, even when scrolling 
document.getElementById('podpis').style.position = 'fixed'; 
//div goes to the bottom of the page 
document.getElementById('podpis').style.bottom = '0'; 
+0

現在需要做的就是ü把標籤和複製/粘貼這第二個選項,當我把它20將從底部20像素? – kancer

+0

This dosent work:/出於某種原因 – kancer

+0

好的問題,我解決。感謝您的幫助和建議。 – kancer

0

是的,你可以使用:

<script> 
    document.getElementById('podpis').style.position = 'absolute'; 
    document.getElementById('podpis').style.position = 'relative'; 
</script> 

希望這有助於。

+0

好吧,你可以給我準備好的代碼,因爲我真的不知道Java。我詢問有關Java解決方案的問題,因爲我的應用程序css被阻止。 – kancer

+0

您必須在我的回答中將標籤添加到您的html頁面中,頭標籤內或''之前,並且取決於您何時更改位置。 –

+0

是的,我的意思是javascript – kancer