マージ方法がわからないスクリプトが 2 つあります。
- スクリプト #1では、URL を読み取り、返された値を出力します。通常は 1 つだけです。
- スクリプト #2 では、1 つ以上の配列からの結果をリストに書き込みます。
スクリプト #1:
function GetUrlValue(VarSearch){
var SearchString = window.location.search.substring(1);
var VariableArray = SearchString.split('&');
for(var i = 0; i < VariableArray.length; i++){
var KeyValuePair = VariableArray[i].split('=');
if(KeyValuePair[0] == VarSearch){
return KeyValuePair[1];
}
}
}
document.write(GetUrlValue('val1'));
document.write("<br>");
document.write(GetUrlValue('val2')); //only used if needed for a second list
document.write("<br>");
スクリプト #2:
function ShowResults(value, index, ar) {
document.write(" • " + value);
document.write("<br />");
}
showCons = 'test this con';
showCaPS = 'caps...test this also';
showComm = 'test comm';
showDES = 'dis des, testing';
var divCons = [[showCons], [showCaPS], [showComm]];
var divCaPS = [[showCaPS], [showComm], [showCons], [showDES]];
var divComm = [[showComm], [showCons]];
var divDES = [[showDES]];
document.write("Cons header <br>");
divCons.forEach(ShowResults);
document.write("<br>");
document.write("CaPS header <br>");
divCaPS.forEach(ShowResults);
document.write("<br>");
SCRIPT 1 で ?val1=cons などをプルした場合、それを SCRIPT 2 に関連付けて、「var divCons」を 3 つの show### 箇条書きのヘッダーとして表示できるかどうかはわかりません。または、val1=caps を使用して、4 つの大文字に関連する show### 箇条書きを表示します。そして、2 番目の情報セットを表示する必要がある場合は、val2 を使用して、それを comm や des などの他の値に設定します。
つまり、「document.write(GetUrlValue('val1'));」を使用してページに値を出力する代わりに、「divCons.forEach( ShowResults); ."
私に優しくしてください、私はコーダーではありません。私たちのコア開発者であるため、このタスクは私にかかっています。チームは現在、この作業を処理できません。前もって感謝します。:)
何か案は?
ありがとう。