根据ID选中

var name = document.getElementsById("mainStack");

原文地址:https://www.cnblogs.com/7q4w1e/p/9548864.html