在HTML中创建调查可以使用表单元素和按钮元素来实现。以下是一个示例代码:
<!DOCTYPE html>
<html>
<head>
<title>调查问卷</title>
</head>
<body>
<h1>调查问卷</h1>
<form>
<p>问题1:你喜欢哪种编程语言?</p>
<button type="button" onclick="location.href='问题1.html'">Java</button>
<button type="button" onclick="location.href='问题1.html'">Python</button>
<button type="button" onclick="location.href='问题1.html'">JavaScript</button>
<button type="button" onclick="location.href='问题1.html'">C++</button>
<p>问题2:你对云计算有何了解?</p>
<button type="button" onclick="location.href='问题2.html'">云计算概念</button>
<button type="button" onclick="location.href='问题2.html'">云计算分类</button>
<button type="button" onclick="location.href='问题2.html'">云计算优势</button>
<button type="button" onclick="location.href='问题2.html'">云计算应用场景</button>
<!-- 添加更多问题和选项 -->
</form>
</body>
</html>
在上述示例中,我们使用<form>
元素来创建一个表单,每个问题都使用<p>
元素进行标识,并使用<button>
元素作为答案选项。通过设置onclick
属性,可以将每个按钮链接到等效的问题页面。你可以根据需要添加更多的问题和选项。
请注意,上述示例中的链接地址(例如问题1.html
和问题2.html
)是示意性的,你需要根据实际情况将其替换为相应的链接地址。此外,你还可以根据需要对按钮样式进行自定义。
领取专属 10元无门槛券
手把手带您无忧上云