Welcome

カキノタblog

自分の興味あるテーマを中心に、図解多めに記事を作成していきたいと思います。

ツール Kindle Unlimited検索

自分用に検索Boxを作ってみました。

ソース

function location_ku(evt){
	if(evt.keyCode == 13){
		var srchbox_el = document.querySelector(".srchbox");
		var s = srchbox_el.value;
		var url = "https://www.amazon.co.jp/s?k=" + s + "&rh=p_n_feature_nineteen_browse-bin:3169286051&ref=sr_nr_p_n_feature_nineteen_0";
		window.open(url, '_blank')
	}
}
var srchbox_el = document.createElement("input");
srchbox_el.setAttribute("class","srchbox");
var srchbtn_el = document.createElement("button");
srchbtn_el.textContent = "submit";

srchbox_el.addEventListener("keydown",(evt)=>{location_ku(evt);})
srchbtn_el.addEventListener("click",(evt)=>{console.log(evt);})
var tar_el = document.querySelector(".main_content");
tar_el.appendChild(srchbox_el);
tar_el.appendChild(srchbtn_el);