0
사용자가 테이블을 두 번 클릭하고 내림차순 또는 오름차순으로 바꾸는 함수를 작성하고 정렬 함수를 완료했지만 함께 모으는 방법을 모르지만, 지금은 단지 다음과 같은 헤더로 중 하나를 넣어 :두 함수를 함께 넣는 방법
function sortBy(sKey)
{
document.sortResultsForm.sSortBy.value=sKey;
document.sortResultsForm.submit();
}
if($sSortBy=="District")
{
usort($tempArr, 'sortDistrictNameascend');
}
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr> <td class="headTable" width=15%>
<a href="javascript:sortBy('District');"
><font color=white>District</font></a>
</td>
을 나는 사용자가 정렬 순서를 변경하려면 더블 클릭하자 헤더에 다른 기능을 넣어하는 방법을 모른다, 같은 주문 기능은 다음과 :
function sortDistrictNamedescend($a, $b)
{
if ($a->DistrictName == $b->DistrictName)
{
return 0;
}
return ($a->DistrictName < $b->DistrictName) ? 1 : -1;
}
usort($tempArr, 'sortDistrictNamedescend');
아무도 도와 줄 수 없다. 정말 고마워. 그 ' "내림차순"당신이 인쇄 해 주면
mypage.php?sort=asc
하고 PHP 스크립트 내에서 mypage.php?sort=desc
, 당신은 $_GET["sort"];
의 값을 확인합니다 :
매우 혼란스러워 보입니다. 이 코드의 절반은 PHP이고 나머지 절반은 JavaScript입니다. –