我正在使用MVC3與剃刀,用於顯示一個網格我正在使用WebGrid,併爲此非常網格分頁使用下面的代碼。使用剃刀和MVC3的webgrid的尋呼機方法的CSS修復程序
我的問題:分頁按鈕應保持相同的大小,當他們被選中/點擊,當他們沒有被選中/點擊。
我有,我已經使用CSS和JavaScript來實現設計,我的客戶希望我在this撥弄鏈接複製它http://fiddle.jshell.net/Z5L4g/
剃刀代碼
@grid.Pager(mode: WebGridPagerModes.All, numericLinksCount: 15, firstText: "<<", lastText: ">>", previousText: "<", nextText: ">")
一些CSS問題我的CSS代碼 body { font-family:Calibri; background-color: #D8D8D8; margin-top:0px; text-decoration:none; }
#footer:not([href]) {
letter-spacing: 0px;
}
#footer {
text-align: center;
margin-top: 10px;
}
.pagingCss {
font-size: 13px;
}
.whiteBox {
background-color:
white;
color:
black;
padding-right: 7px;
padding-left: 7px;
padding-top: 4px;
padding-bottom: 4px;
text-decoration: none;
margin-top: 10px;
letter-spacing: 0px;
}
.blackBox {
background-color:
black;
color:
white;
padding-right: 7px;
padding-left: 7px;
padding-top: 4px;
padding-bottom: 4px;
text-decoration: none;
margin-top: 10px;
letter-spacing: 0px;
}
.pagingCss a {
font-size: 13px;
color: white;
text-decoration:none;
}
的Javascript我已經使用
var keywords = ['>>', '<<', '<', '>'];
function linklabels() {
var footerDiv = document.getElementById('footer');
var oldLinks = footerDiv.getElementsByTagName('A');
var oldLinksCount = oldLinks.length;
var keywordsCount = keywords.length;
for (var i = 0; i < oldLinks.length; i++) {
if (oldLinks[i].firstChild.nodeValue == '>>' || oldLinks[i].firstChild.nodeValue == '<<' || oldLinks[i].firstChild.nodeValue == '>' || oldLinks[i].firstChild.nodeValue == '<') {
var my_div = null;
var newDiv = null;
var newDiv = document.createElement("span");
var newContent = document.createTextNode(oldLinks[i].firstChild.nodeValue);
newDiv.appendChild(newContent);
newDiv.className = "whiteBox";
oldLinks[i].firstChild.nodeValue = "";
oldLinks[i].appendChild(newDiv);
}
else {
var my_div = null;
var newDiv = null;
var newDiv = document.createElement("span");
var newContent = document.createTextNode(oldLinks[i].firstChild.nodeValue);
newDiv.appendChild(newContent);
newDiv.className = "blackBox";
oldLinks[i].firstChild.nodeValue = "";
oldLinks[i].appendChild(newDiv);
}
} // end of for
// footer
}
window.onload = linklabels;
下面的代碼是我的HTML是如何使用上面的代碼
後呈現和代碼呈現爲HTML低於
<div id="footer" class="pagingCss">
<a href="/CompanySearch/Home/Results?page=1">
<span class="whiteBox"><<</span>
</a>
<a href="/CompanySearch/Home/Results?page=5">
<span class="whiteBox"><</span>
</a>
<a href="/CompanySearch/Home/Results?page=1">
<span class="blackBox">1</span>
</a>
<a href="/CompanySearch/Home/Results?page=2">
<span class="blackBox">2</span>
</a>
<a href="/CompanySearch/Home/Results?page=3">
<span class="blackBox">3</span>
</a>
<a href="/CompanySearch/Home/Results?page=4">
<span class="blackBox">4</span>
</a>
<a href="/CompanySearch/Home/Results?page=5">
<span class="blackBox">5</span>
</a>
6 <a href="/CompanySearch/Home/Results?page=7">
<span class="blackBox">7</span>
</a>
<a href="/CompanySearch/Home/Results?page=8">
<span class="blackBox">8</span>
</a>
<a href="/CompanySearch/Home/Results?page=9">
<span class="blackBox">9</span>
</a>
<a href="/CompanySearch/Home/Results?page=10">
<span class="blackBox">10</span>
</a>
<a href="/CompanySearch/Home/Results?page=7">
<span class="whiteBox">></span>
</a>
<a href="/CompanySearch/Home/Results?page=10">
<span class="whiteBox">>></span>
</a>
</div>
我知道必須有一些方法或技巧來做到這一點,這是我找不到的......請幫我解決這個問題。
我試過這個,jquery圍繞每個頁面鏈接這個新的span class ='selectedBox'我不會很好地經文將jquery你能幫我一下這個:) – Yasser
@亞瑟請檢查出我更新的答案:) – whosrdaddy
工作!非常感謝你!拯救了我的一天 – Yasser