例如:document.form[0].elements[23]将产生一些输入<input id = test2>。我需要通过id或name = 'test2‘来得到类似于var n = document.getElementById('test2').getDOMNodeIndex(); // n = 23的那个var
我想用javascript获取父标签的id。在这个例子中,文本"stackoverflow“的父id是"sofsite”," this“的父id是"sofbody”。<body id = 'sofbody'>
This is <a href = "www.stackoverflow.com" id = "sofsite">stackoverflow<