Javascript HTML复选框,如何加载xml页面?
我需要在两个单独的xml页面上加载复选框。我在HTML中有它们,但是我不知道如何限制它们只出现在单独的xml页面上 JAVASCRIPTJavascript HTML复选框,如何加载xml页面?,javascript,html,xml,Javascript,Html,Xml,我需要在两个单独的xml页面上加载复选框。我在HTML中有它们,但是我不知道如何限制它们只出现在单独的xml页面上 JAVASCRIPT function init() { document.getElementById('one').onclick = function(){ getData('shop1.xml'); } document.getElementById('two').onclick = function(){ getData('shop2.xml'); } } fu
function init()
{
document.getElementById('one').onclick = function(){ getData('shop1.xml'); }
document.getElementById('two').onclick = function(){ getData('shop2.xml'); }
}
function checkbox()
{
document.getElementById('checkbox').onload = function(){ getData('checkbox');}
}
window.onload = init;
HTML
<input type = "checkbox"> <span> 1</span>
<input type = "checkbox"> <span> 2</span>
<input type = "checkbox"> <span> 3</span>
函数init()
{
document.getElementById('one').onclick=function(){getData('shop1.xml');}
document.getElementById('two').onclick=function(){getData('shop2.xml');}
}
函数复选框()
{
document.getElementById('checkbox')。onload=function(){getData('checkbox');}
}
window.onload=init;
HTML
1.
2.
3.
wgetData
函数在做什么?ID为one
antwo
的元素是什么?函数checkbox()
正在尝试获取id为checkbox
的元素,该元素在您提供的HTML中不存在。getData
函数在做什么?ID为one
antwo
的元素是什么?函数checkbox()
正在尝试获取id为checkbox
的元素,该元素在您提供的HTML中不存在。