JavaScript

  Amazon ISBN



  
<SCRIPT language="JavaScript">

	var dom,dom2,bIE;
	var processor,newFragment;	// for Mozilla
	var objXMLHttp;

	if ( document.all ) {
		bIE = true;
		dom = new ActiveXObject("Msxml2.DOMDocument.3.0");
		dom2 = new ActiveXObject("Msxml2.DOMDocument.3.0");
		objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
	}
	else {
		bIE = false;
		dom = document.implementation.createDocument("", "", null);
		dom2 = document.implementation.createDocument("", "", null);
		objXMLHttp = new XMLHttpRequest();
	}

	dom.async = false;
	dom2.async = false;

function DirectXML() {

	parent.BodyFrame.location = 
		"http://winofsql.jp/xml/php/amazon/isbn.php?isbn="
		+ document.getElementById("ISBN").value

}

function TextXML() {

	var strWork,re;

	if ( bIE ) {
		objXMLHttp.open( "GET", "http://winofsql.jp/xml/php/amazon/isbn.php?isbn="
			+ document.getElementById("ISBN").value, false );
		objXMLHttp.send("");
		dom = objXMLHttp.responseXML;

		strWork = dom.xml;
		re = /</g
		strWork = strWork.replace( re, "&lt;" );
		re = />/g
		strWork = strWork.replace( re, "&gt;\n" );

		parent.BodyFrame.document.open();
		parent.BodyFrame.document.write( "<pre>" );
		parent.BodyFrame.document.write( strWork );
		parent.BodyFrame.document.write( "</pre>" );
		parent.BodyFrame.document.close();
	}
	else {
		objXMLHttp.open( "GET", "http://winofsql.jp/xml/php/amazon/isbn.php?isbn="
			+ document.getElementsByName("ISBN")[0].value, false );
		objXMLHttp.send("");
		strWork = objXMLHttp.responseText;

		re = /</g
		strWork = strWork.replace( re, "&lt;" );
		re = />/g
		strWork = strWork.replace( re, "&gt;\n" );

		parent.BodyFrame.document.open();
		parent.BodyFrame.document.write( "<pre>" );
		parent.BodyFrame.document.write( strWork );
		parent.BodyFrame.document.write( "</pre>" );
		parent.BodyFrame.document.close();
	}

}

function TagXML() {

	var objNodeList;

	if ( bIE ) {
		objXMLHttp.open( "GET", "http://winofsql.jp/xml/php/amazon/isbn.php?isbn="
			+ document.getElementById("ISBN").value, false );
		objXMLHttp.send("");
		dom = objXMLHttp.responseXML;

		objNodeList = 
			dom.getElementsByTagName(document.getElementById("TAGNAME").value);
		parent.BodyFrame.document.open();
		parent.BodyFrame.document.write( "<pre>" );

		PrintNode( objNodeList );

		parent.BodyFrame.document.write( "</pre>" );
		parent.BodyFrame.document.close();
	}
	else {
		objXMLHttp.open( "GET", "http://winofsql.jp/xml/php/amazon/isbn.php?isbn="
			+ document.getElementsByName("ISBN")[0].value, false );
		objXMLHttp.send("");
		dom = objXMLHttp.responseXML;

		objNodeList = 
			dom.getElementsByTagName(document.getElementById("TAGNAME").value);
		parent.BodyFrame.document.open();
		parent.BodyFrame.document.write( "<pre>" );

		PrintNode( objNodeList );

		parent.BodyFrame.document.write( "</pre>" );
		parent.BodyFrame.document.close();
	}

}


function PrintNode ( objNodeList ) {

	var i,j,nLength;
	var objNode,objAtts;

	nLength = objNodeList.length;
	for( i = 0; i < nLength; i++ ) {
		objNode = objNodeList.item( i );
		if ( objNode.hasChildNodes() ) {
			PrintNode( objNode.childNodes );
		}
		else {
			parent.BodyFrame.document.write( objNode.parentNode.nodeName );
			parent.BodyFrame.document.write( "|" );
			parent.BodyFrame.document.write( objNode.parentNode.nodeType );
			parent.BodyFrame.document.write( "|" );
			parent.BodyFrame.document.write( objNode.nodeName );
			parent.BodyFrame.document.write( "|" );
			parent.BodyFrame.document.write( objNode.nodeType );
			parent.BodyFrame.document.write( "|" );

			objAtts = objNode.parentNode.attributes;
			if ( objAtts.length != 0 ) {
				parent.BodyFrame.document.write( "(" );
				for( j = 0; j < objAtts.length; j++ ) {
					if ( j != 0 ) {
						parent.BodyFrame.document.write( "|" );
					}
					parent.BodyFrame.document.write(
						objAtts.item( j ).nodeName );
					parent.BodyFrame.document.write( "|" );
					parent.BodyFrame.document.write(
						objAtts.item( j ).nodeValue );
				}
				parent.BodyFrame.document.write( ")" );
			}

			parent.BodyFrame.document.writeln( objNode.nodeValue );
		}
	}

}

</SCRIPT>

<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=Shift_JIS">
<STYLE>
	BODY {
		background-color:white
		font-family:Verdana,'MS Pゴシック';
		font-size:13;
	}
</STYLE>
</HEAD>
<BODY>

<FORM
	name=frmMain
	method=POST
	action=view.cgi
	target=BodyFrame
>

amazon コード
<INPUT
	id=ISBN
	type=text
	name=ISBN
	value="B000062X90"
>
&nbsp;
<INPUT
	type=button
	name=send
	value="Direct XML"
	onClick='DirectXML()'
>
&nbsp;
<INPUT
	type=button
	name=send
	value="テキスト表示"
	onClick='TextXML()'
>
&nbsp;
要素名
<INPUT
	type=text
	id=TAGNAME
	name=TAGNAME
	comm_disabled
	comm_style='background-color:silver'
>
&nbsp;
<INPUT
	type=button
	name=send
	value="タグ名指定"
	comm_disabled
	onClick='TagXML()'
>
<br><SPAN id="forMozilla">Direct XML の後はこのボタンでクリアして下さい --> 
<INPUT 
	type=button
	value="クリア"
	onClick='parent.BodyFrame.location = "blank.htm";'
></SPAN>
</FORM>
</BODY>
</HTML>
<SCRIPT for=window event=onload language=JavaScript>

	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		document.getElementById("forMozilla").style.display = "none";
	}

</SCRIPT>
  










  infoboard   管理者用   
このエントリーをはてなブックマークに追加




SQLの窓  天気  IT用語辞典
Yahoo!ニュース  マルチ辞書
PHP マニュアル  Google URL短縮 


フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ