ページ番号を次のボタンを押すと、値next
がPHPスクリプトに送信できるようにjavascript変数に割り当てられます。私はこれまでのところ、これを持っているが、私はJavaScriptを使用して非常に精通していないです:ボタンをクリックしたときにjavascript変数を入力します
nextpage = document.getElementById('nextpage').onclick = document.getElementById('nextpage').value;
if(!nextpage==0){
link =link+"&nextpage="+nextpage;
}
一方、PHPスクリプトはこのようにそれを拾うことができるようにJavascriptの変数をURLに掲載されますこの方法です。私が使用する他の変数の場合:私はこれを行う場合は、PHPスクリプトは常にそれが私の意図ではない、次のページにスキップする必要があると考えて
mantinee = document.zoekform.mantinee.value;
if(!mantinee==0){
link =link+"&mantinee="+mantinee;
}
、それが直接のURLに掲載されています。ボタンをクリックすると、その側のボタンにajaxgetinfo()
が呼び出されます。ここで
query.php
if(isset($_POST['nextpage']))
{
$nextpage = $_POST['nextpage'];
}
は、すべての変数を取得し、それらを通過するすべてのJavaScriptです。 NEXTPAGEも
function vorige(){
sort = 'vorige';
ajaxGetInfo(sort);
}
機能ajaxGetInfo(ソート) {VARをajaxRequest実行する必要がある場所です。ボタン(value="nextpage"
とname="nextpage"
)が押されるまでJavaScript変数(nextpage
)は空のままであるように、//デ変数ワットのAjax mogelijkのmaakt
try{
// Chrome, Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
link="query.php?";
datumreeks='';
if(document.zoekform.zo.checked==true){datumreeks="zondag";}
if(document.zoekform.ma.checked==true){datumreeks=datumreeks+"maandag-";}
if(document.zoekform.di.checked==true){datumreeks=datumreeks+"dinsdag-";}
if(document.zoekform.wo.checked==true){datumreeks=datumreeks+"woensdag-";}
if(document.zoekform.don.checked==true){datumreeks=datumreeks+"donderdag-";}
if(document.zoekform.vr.checked==true){datumreeks=datumreeks+"vrijdag-";}
if(document.zoekform.za.checked==true){datumreeks=datumreeks+"zaterdag-";}
link = link+"&datumreeks="+datumreeks;
datepicker = document.zoekform.datepicker.value;
if(!datepicker==0){link =link+"&datepicker="+datepicker;}
datepicker2 = document.zoekform.datepicker2.value;
if(!datepicker2==0){link =link+"&datepicker2="+datepicker2;}
zaal = document.zoekform.zaal.value;
if(!zaal==0){link =link+"&zaal="+zaal;}
genre = document.zoekform.genre.value;
if(!genre==0){link =link+"&genre="+genre;}
profiel = document.zoekform.profiel.value;
if(!profiel==0){link =link+"&profiel="+profiel;}
internationaal = document.zoekform.internationaal.value;
if(!internationaal==0){link =link+"&internationaal="+internationaal;}
prijslaag = document.zoekform.prijslaag.value;
if(!prijslaag==0){link =link+"&prijslaag="+prijslaag;}
prijshoog = document.zoekform.prijshoog.value;
if(!prijshoog==0){link =link+"&prijshoog="+prijshoog;}
mantinee = document.zoekform.mantinee.value;
if(!mantinee==0){link =link+"&mantinee="+mantinee;}
document.getElementById('nextpage').onclick = function(e){
ajaxRequest.open("POST", link, true);
if (nextpage) ajaxRequest.send("nextpage=yes");
}
ajaxRequest.open("GET", link, true);
ajaxRequest.send(null);
document.getElementById("info").innerHTML = '<div align=center><i class="material-icons w3-spin w3-jumbo">refresh</i></br>Blijft dit staan? <a href="" onclick="ajaxGetInfo()">Klik hier.</a></div>';
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
document.getElementById("info").innerHTML = ajaxRequest.responseText;
}
}
}
は、どのように私はそれを行うことができますか?それが押されたとき、javascriptの変数nextpage
は"NEXTPAGE" を含める必要があります
が、上をクリックする何のボタンは存在しません:ここ
は一例ですか?サブミットによってページがリフレッシュされます。私はタブでサイトを構築したので、リフレッシュはオプションではありません – Mark
また、nextpageの値は、他の賢いキーを押したときにのみ入力する必要があります。値が空であれば、 – Mark
あなたはあなたの質問に「次へ」ボタンがあると言ったのですか?あなたの問題を編集したので、私はあなたの問題を理解していません。 – markt