1. ノード名の決定
1.getElementById
2.getElementsByTagName
3.getElementsByClassName
4.クエリセレクター
2. ノード名の情報を取得します。
var 字段名 = document.getElementsByClassName("节点名" );
例如:
var arr = document.getElementsByClassName("a");
console.log(arr);//打印输出
f12 コンソールに表示される結果
3. 取得した情報の傍受
var Shop_info = arr[1].outerText;//获取数组里第二项的outerText的值
console.log(Shop_info)//输出的内容为xxx\nID:123456
var arr1 = Shop_info.split("\nID:");//截取\nID:前后的值
var Shop_Name = arr1[0];//第一个值为: xxx
var Shop_Id = arr1[1];//第二个值为: 123456
console.log(Shop_Id)
console.log(Shop_Name)