The Code
Save this piece of HTML as a text file on your computer. Name it
something appropriate
(cd_asin.html will
do nicely).
<html>
<head>
<title>Find a CD's ASIN</title>
<script language="JavaScript">
function getDetailPage(upc) {
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("GET", "http://xml.amazon.com/onca/xml2?t=webservices-&return;
20&dev-t=insert developer'stoken&UpcSearch="+upc+"&mode=music&type=lite&return;
&f=xml", false);
xmlhttp.Send( );
var response = xmlhttp.responseXML;
if (response.selectSingleNode("/ProductInfo/ErrorMsg")) {
alert(response.selectSingleNode("/ProductInfo/ErrorMsg").text);
} else {
var asin = response.selectSingleNode("/ProductInfo/Details/Asin")&return;
.text;
document.location = "http://amazon.com/o/ASIN/" + asin;
}
}
</script>
</head>
<body>
<form>
<input name="upc" type="text" size="25">
<input type="button" value="Go"
onClick="getDetailPage(document.forms[0].upc.value);">
</form>
</body>
</html>