有没有一种简单的方法可以让单选按钮切换-当它附近的文本被单击时-而不需要在我的小PHP项目中引入任何大的Javascript框架?

Web表单如下所示:

<html>
<body>
<form method="post">
<p>Mode:<br /> 
<input type="radio" name="mode" value="create"><i>create table</i><br />
<input type="radio" name="mode" value="select" checked>select records (can specify id)<br />
<input type="radio" name="mode" value="insert">insert 1 record (must specify all)<br />
<input type="radio" name="mode" value="delete">delete records (must specify id)<br />
<input type="radio" name="mode" value="drop"><i>drop table</i><br />
</p>
<p>Id: <input type="text" name="id" size=32 maxlength=32 /> (32 hex chars)</p>

<p>Latitude: <input type="text" name="lat" size=10 /> (between -90 and 90)</p>
<p>Longitude: <input type="text" name="lng" size=10 /> (between -90 and 90)</p>
<p>Speed: <input type="text" name="spd" size=10 /> (not negative)</p>
<p><input type="submit" value="OK" /></p>
</form>
</body>
</html>

推荐答案

您还可以对元素without进行换行, for each 元素赋予一个ID,因为<label>隐式表示其包含的输入,如下所示:

<label>
   <input type="radio" name="mode" value="create">
   <i>create table</i>
</label>

Html相关问答推荐

R中的动态Webscraping

CSS:显示块,第一个项目没有正确对齐

UseEffect()从不调用preact

如何在css中将包含多行文本的多个p-tag放在一起(并排)?

垂直页眉,每行只显示一个使用css的字母

我怎样才能在我的网站上制作花哨的角落

现代网络浏览器可以并行下载哪些类型的网络资源?还有,什么东西不能并行下载?

子元素的单一背景

Flexbox在元素之间造成了太大的差距

如何用css在右侧创建多个半圆

在TWebLabel标题中设置换行符/换行符的方法?

我的 *ngFor 中的 array.reverse() 在生产中不起作用

如何在 VS Code 中 Select 和删除 HTML 元素(其标签和内容)?

Tailwind 网格行高度可防止拉伸到最高行的所有相同高度

使用 calc 函数设置字体大小时 Flexbox 项目重叠

th 内的 div 标签没有占据全高

暗模式转换器

将 div 放在图片旁边而不是下方

右对齐 bootstrap 导航项而不是下拉菜单

嵌套固定定位的 Div 滚动条渗透到前景中的 Div