我正在尝试创建一个地图,其中一个选项为dif添加了名称。街道。我的计划是使用复选框和usemap-information包含此功能。
由于我对这些组件如何协同工作的理解有限,我打了个停顿,这是我的非功能性代码:
<head>
<script>
var checkbox1 = document.getElementById("checkbox1");
var posting = document.getElementById("post_location");
function visVei(){
if (checkbox1.checked){posting="
<map name='kartet_info' style='cursor:help'>
<Area shape=poly coords=326, 463, 278, 103, 286, 101, 336, 464 onmouseover=writeText2('Prinsen Gate'); onmouseout=writeText2('');/></map>"
}
}
</script>
</head>
这应该写成:
<span id="post_location" style="display:none;"></span>
一次
<form action="">
<input type="checkbox" class="check_1" id="checkbox1" onchange="visVei();"><span class="in_check_1">Gatenavn</span></input>
</form>
已核实。
答案 0 :(得分:0)
试试这个
<script type="text/javascript">
var checkbox1 = document.getElementById("checkbox1");
var posting = document.getElementById("post_location");
function visVei(){
if (checkbox1.checked){
posting.innerHTML="<map name='kartet_info' style='cursor:help'><Area shape=poly coords=326, 463, 278,103, 286, 101, 336, 464 onmouseover=writeText2('Prinsen Gate'); onmouseout=writeText2('');/></map>";
posting.style.display = "block";
}
}
</script>