所以我写了一个简单的流程图,我可能做错了,但它似乎按照我的方式工作,设计明智。代码方面,我似乎做错了什么,它应该显示 4 个元素,h1 和 3 个 div 显示您的选项,当您单击是或否时,它将显示与您相关的其他元素这里的选择是我的标记,我已经通过http://validator.w3.org/运行它,它说它很好。
在第 150 行,它说我在 Dreamweaver 中有语法错误(我使用的程序)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style>
body{background-color:#999}
p{color:#0CF}
h1{
color:#03C;
text-align:center;
}
#q1{
position:absolute;
left:293px;
top:41px;
border:thin black solid;
background-color:#9CF;
width: 531px;
height: 72px;
font-size:64px
}
#q2{
position:absolute;
left:424px;
top:257px;
border:thin black solid;
background-color:#9CF;
width: 62px;
height: 54px;
font-size:48px;
}
#q3{
position:absolute;
left:633px;
top:405px;
border:thin black solid;
background-color:#9CF;
width: 186px;
height: 39px;
font-size:32px
}
#q4{
position:absolute;
left:494px;
top:145px;
border:thin black solid;
background-color:#9CF;
width: 100px;
height: 165px;
font-size:36px
}
#q5{
position:absolute;
left:633px;
top:255px;
border:thin black solid;
background-color:#9CF;
width: 74px;
height: 55px;
font-size:48px;
}
#q6{
position:absolute;
left:573px;
top:407px;
border:thin black solid;
background-color:#9CF;
width: 50px;
height: 39px;
font-size: 36px
}
#q7{
position:absolute;
left:240px;
top:404px;
border:thin black solid;
background-color:#9CF;
width: 246px;
height: 41px;
font-size:36px;
}
#q8{
position:absolute;
left:671px;
top:317px;
border:thin black solid;
background-color:#000;
width: 2px;
height: 82px;
}
#q11{
position:absolute;
left:854px;
top:453px;
border:thin black solid;
background-color:#000;
width: 5px;
height: 59px;
font-size:36px;
}
#q12{
position:absolute;
left:449px;
top:319px;
border:thin black solid;
background-color:#000;
width: 4px;
height: 78px;
font-size:36px;
}
#q13{
position:absolute;
left:551px;
top:519px;
border:thin black solid;
background-color:#9CF;
width: 371px;
height: 44px;
font-size:36px;
}
#q14{
position:absolute;
left:826px;
top:401px;
border:thin black solid;
background-color:#9CF;
width: 61px;
height: 44px;
font-size:36px;
}
#q15{
position:absolute;
left:602px;
top:454px;
border:thin black solid;
background-color:#000;
width: 5px;
height: 57px;
font-size:36px;
}
.hidden{
visibility:hidden
}
</style>
<script>
function show (x) {
var a=document.getElementById(x)
a.style.visiblity.visible
</script>
</head>
<!-- ADD IDS TO HIDDEN CLASSES, MAKE FUNCTION TO SHOW THEM ON NON-HIDDEN ELEMENTS -->
<body>
<div id="q1">Should You Worry?</div>
<div id="q2" onClick="show('q7')">No</div>
<div id="q3" class="hidden" >Can you fix it?</div>
<div id="q4"> Do you have a problem?</div>
<div id="q5" onClick="show('q3,q6,q14')">Yes</div>
<div id="q6" class="hidden" onClick="show('q13')">No</div>
<div id="q7" class="hidden">Then don't worry</div>
<div id="q8" class="hidden"></div>
<div id="q11" class="hidden"></div>
<div id="q12" class="hidden"></div>
<div id="q13" class="hidden">Then don't worry about it!</div>
<div id="q14" class="hidden" onClick="show('q13')">Yes</div>
<div id="q15" class="hidden"></div>
</body>
</html>