可通过 radio 元素的 type 属性来读取表单中单选按钮的控件类型信息。
1、 创建一个名为 radio_type 的 HTML 文件。

2、 在页面中添加一个 <input> 标签,设置其 type="radio",并指定 id="my\_radio\_id\_type"。

3、 插入一个 <button></button> 按钮,绑定点击事件,用于调用自定义函数 my\_radio\_type()。
4、 添加一个 <p></p><div class="aritcle_card flexRow">
<div class="artcardd flexRow">
<a class="aritcle_card_img" href="/xiazai/skill11244" title="Convert Markdown To HTML And PDF - Markdown和HTML、PDF互转"><img
src="https://img.php.cn/upload/skill/001/246/273/6adaf20d79f23518.jpg" alt="Convert Markdown To HTML And PDF - Markdown和HTML、PDF互转" ></a>
<div class="aritcle_card_info flexColumn">
<a href="/xiazai/skill11244" title="Convert Markdown To HTML And PDF - Markdown和HTML、PDF互转">Convert Markdown To HTML And PDF - Markdown和HTML、PDF互转</a>
<p>实现 Markdown↔ HTML 互转,支持导出 PDF,用于用户请求的文档格式转换。</p>
</div>
<a href="/xiazai/skill11244" title="Convert Markdown To HTML And PDF - Markdown和HTML、PDF互转" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span> </a>
</div>
</div> 标签,并为其设置 id="show\_radio\_type",作为结果显示区域。

5、 在 <script></script> 标签中声明一个名为 my\_radio\_type 的 JavaScript 函数。

6、 在该函数内部,通过 document.getElementById() 获取对应 radio 元素,访问其 type 属性值,并将该值赋给 <p></p> 标签的 innerText 或 textContent,实现动态展示。
7、 使用浏览器打开该 HTML 文件,点击按钮,即可在页面上看到单选按钮的 type 值(即 "radio")被成功输出。


















