我有一个性别行,带有男性和女性的单选按钮.当我第一次注册时,单选按钮的值将存储在数据库中.现在我的问题是,如果我再次编辑该行,它希望来(这意味着已检查)该值为男/女.怎么做?
注意:使用php.
HTML脚本:
<tr id="inside">
<td align="right" width="40%" id="side" >Gender</td>
<td width="3%"> </td>
<td align="left" width="50%">
<input type="radio" name="sex" value="Male" size="17">Male
<input type="radio" name="sex" value="Female" size="17">Female
</td>
</tr>
Run Code Online (Sandbox Code Playgroud) 我需要使用jquery检索可点击按钮的值.我有3个按钮<div>.
<div class="button1">
<input type="button" value="one" id="One" onclick= "location.href='index.html'"/>
<input type="button" value="two" id="Two" onclick="location.href='index.html'" />
<input type="button" value="three" id="Three" onclick="location.href='index.html'" />
</div>
Run Code Online (Sandbox Code Playgroud)
如果我点击按钮1我需要获得按钮1的值.我不知道如何获得这个值.
这是我的js.
$(document).ready(function() {
$('.button1').click(function() {
var text = $(this).text();
$("input").val(text);
});
});
Run Code Online (Sandbox Code Playgroud)
我知道这个js脚本我写错了.因为我的价值观是"一,二,三".
提前致谢.
我需要拆分一个字符串并将其存储在一个数组中.这里我使用了string.gmatch方法,并且它完全分割了字符,但我的问题是如何存储在数组中?这是我的剧本.我的示例字符串格式:touchingSpriteName = Sprite,10,rose
objProp = {}
for key, value in string.gmatch(touchedSpriteName,"%w+") do
objProp[key] = value
print ( objProp[2] )
end
Run Code Online (Sandbox Code Playgroud)
如果我打印(objProp)它给出的确切值.
我真的很震惊。实际上问题是,我有 2 个网页名称为 menu.html 和 index.html。在 menu.html 中,我有 3 个按钮,例如“一、二、三”,当我单击任何一个按钮时,它会重定向到 index.html。所以,我写了一个 common.js 文件来获取我在 menu.html 中单击的按钮的值。我已将 common.js 包含到 menu.html 和 index.html 中。
常见的.js:
var text=" ";
$(document).ready(function() {
$('input:button').click(function() {
text = $(this).val();
alert(text); //here am getting correct values for a button like 'one,two or three' in menu.html page
});
});
Run Code Online (Sandbox Code Playgroud)
现在我需要在 index.html 中的 another.js 文件中获取“文本”的值。
另一个.js:
$(document).ready(function() {
alert("text "+text); //here am getting empty value.
});
Run Code Online (Sandbox Code Playgroud)
此外,我正确地包含在 index.html 中:
<script src="common.js" type="text/javascript"></script>
<script src="another.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
这里做错了什么?提前谢谢你。
在这里,我有3个文本字段考虑为a1,a2和a3,现在我需要将a1 * a2的值相乘并将答案更新为第三个字段。我该如何用jQuery?jQuery中是否有任何更新功能?
我需要替换lua中的键的值,例如考虑一个表
t = {"book", "ball", "bank"}
Run Code Online (Sandbox Code Playgroud)
在这里我需要更改"box"而不是"ball"的值.怎么做 ?
以前我试过找到一个关键值并改变,但它没有用!!!
for key, value in pairs(t) do
if key == 2 then
value = "box"
end
end
Run Code Online (Sandbox Code Playgroud)
但它没有用..如果有人知道替代方式,请给我建议?