リンク集(XMLの検索)

 

このページはIE5.0以上でご覧下さい。

 

ホーム土曜塾楽しいXML

 
 
 

(構成は、1つのHTML[このページ]と1つのXML[データ文書格納ファイル]で、当ページでオプション選択後、"検索開始"ボタンがクリックされたら、当ページのJavaScriptで<XMLファイルからデータを読込んだ後、表示用HTMLを作成し、>出力します。)

 
 
     
 
 

オプションを選択して下さい。
リンク付きロゴ画像を付ける
タイトル名を付ける
ジャンルを付ける
説明を付ける

ジャンルの範囲(1:XML関連 2:マルチメディア 3:ソフトウェア 4:面白いHP 5:その他)



サーチ文字列
タイトル名に含まれる文字列
空欄のまま残すと、すべてが該当するものと見なします

 
 
     





"); doc.writeln(""); setStatus("Done!"); } // XMLドキュメントのツリーを歩く! function walkRootElement(elem) { var children, cChildren, child var i, length; // 最初のエレメントは実在するか? 無ければエラー if (elem == null) { alert("elem == null"); window = document; // 強制的にエラーで止める } // 最初のエレメントはか? 違っていたらエラー if( GetTagName(elem) != "ALL" ) { alert("GetTagName(elem) != \"ALL\""); window = document; // 強制的にエラーで止める } // 子エレメントを列挙 children = elem.children; if (children != null) { cChildren = children.length; for (i = 0; i < cChildren; i++) { // 1レコードを表示(条件によっては表示しないかも) child = children.item(i); dump1Record(child); // 表示レコード数が10を超えたら、1回テーブルを閉じる if( countRecord > 10 ) { doc.writeln(""); MakeNodeHeader(win); countRecord = 0; } } } } // 1レコードを表示(条件によっては表示しないかも) function dump1Record(elem) { var children, cChildren, child var i, length; // 指定エレメントは実在するか? 無ければエラー if (elem == null) { alert("elem == null"); window = document; // 強制的にエラーで止める } children = elem.children; var picture="", linksaki="", name="", janle="", plane=""; // If the element has children, call dumpElement again if (children == null){ alert("children == null"); window = document; // 強制的にエラーで止める } cChildren = children.length; for (i = 0; i < cChildren; i++) { child = children.item(i); var tagname = GetTagName(child); if( tagname == "PICTURE" ) { picture = child.text; } else if( tagname == "LINKSAKI" ) { linksaki = child.text; } else if( tagname == "NAME" ) { name = child.text; } else if( tagname == "JANLE" ) { janle = parseInt(child.text); } else if( tagname == "PLANES" ) { plane = child.text; } else { alert("Unknown Tag " + tagname ); window = document; // 強制的にエラーで止める } } // 重さは指定範囲内? if( parseInt(JANLEMIN.value) > janle || parseInt(JANLEMAX.value) < janle ) { return; // 表示の必要なし } // 名前に指定した文字列を含む? if( name.indexOf(SEARCHNAME.value) == -1 ) { return; // 表示の必要なし } doc.write(""); if( CHECKPICT.checked ) { doc.write("
"); } if( CHECKNAME.checked ) { doc.write(""+"" + name + "" + ""); } if( CHECKJANLE.checked ) { if (janle == 1) { doc.write("" + "" + "XML関連" + "" + ""); } else if(janle == 2) { doc.write("" + "" + "マルチメディア" + "" + ""); } else if(janle == 3) { doc.write("" + "" + "ソフトウェア関連" + "" + ""); } else if(janle == 4) { doc.write("" + "" + "面白いHP" + "" + ""); } else if(janle == 5) { doc.write("" + "" + "そ の 他" + "" + ""); } else { doc.write("" + "" + "なし" + "" + ""); } } if( CHECKPLANE.checked ) { doc.write("" + "" + plane + "" + ""); } doc.write(""); countRecord ++; } // ステータス行に情報を書く function setStatus(s) { win.status = s; } // テーブルの書き出しを作る function MakeNodeHeader(win) { doc.write(""); doc.write("
"); doc.write("

検索結果

"); doc.write("
"); doc.write(""); doc.write(""); if( CHECKPICT.checked ) { doc.write(""); } if( CHECKNAME.checked ) { doc.write(""); } // タグの名前を返す function GetTagName(elem) { if (elem.type == 0) return elem.tagName; else return " "; }
ロゴとリンクタイトル名"); } if( CHECKJANLE.checked ) { doc.write("ジャンル"); } if( CHECKPLANE.checked ) { doc.write("説    明"); } doc.write("