I'm trying to create a map, with an option wich adds names to the dif. streets. My plan was to include this feature with checkboxes and usemap-information.
Due to my limited understanding on how these components work together, I hit a stand-still, here is my non-functional code:
<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>
This is supposed to get written to:
<span id="post_location" style="display:none;"></span>
once
<form action="">
<input type="checkbox" class="check_1" id="checkbox1" onchange="visVei();"><span class="in_check_1">Gatenavn</span></input>
</form>
Is checked off.
Try this
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.