我只想以编程方式重命名带有id = item_30
的图例文本<fieldset data-role='controlgroup'>
<legend id='item_30'>JS</legend>
<input id ='Server1' type='radio' name='Serveridor' value='1' onclick=DefinirServer('www.rotatorsurvey.com') ><label for='Server1'>www.encuesta.ws</label>
<input id ='Server2' type='radio' name='Serveridor' value='2' onclick=DefinirServer('www.rotatortablet.com') ><label for='Server2'>www.onlinesurvey.co</label>
</fieldset>
我试过了:
document.getElementById('Item_30')。innerHTML ='hello guys';
但是CHROME DRAMATICALLY CHASH并说:Uncaught TypeError:无法设置属性'innerHTML'为null
答案 0 :(得分:0)
document.getElementById
区分大小写。改为:
document.getElementById('item_30').innerHTML = 'hello guys';
答案 1 :(得分:0)
这肯定应该有效http://jsfiddle.net/7hgDQ/:
document.getElementById('item_30').innerHTML = 'hello guys';