Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HTML复选框,如何加载xml页面?_Javascript_Html_Xml - Fatal编程技术网

Javascript HTML复选框,如何加载xml页面?

Javascript 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

我需要在两个单独的xml页面上加载复选框。我在HTML中有它们,但是我不知道如何限制它们只出现在单独的xml页面上

JAVASCRIPT

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.

w
getData
函数在做什么?ID为
one
an
two
的元素是什么?函数
checkbox()
正在尝试获取id为
checkbox
的元素,该元素在您提供的HTML中不存在。
getData
函数在做什么?ID为
one
an
two
的元素是什么?函数
checkbox()
正在尝试获取id为
checkbox
的元素,该元素在您提供的HTML中不存在。