You could try:
<script>
function toggle(id, value)
{
document.getElementById( img ).src = "scriptURL?id=" + id+ "&value=" + value; }
</script>
<input type="checkbox" name="toggleBox" onclick="toggle(this.id,this.checked);"/>
<img src="scriptURL" id="img" style="display:none;"/>
The image is hidden, when you click the checkbox it sends a message to the image to re-load from "scriptURL".
“文本URL”可检索控制的名称和价值——你的代码可以摘取这些名称并处理。
It s completely transparent to the user and doesn t need any additional frameworks.
Or
<script>
function toggle(id, value)
{
var url = "scriptURL?id=" + id+ "&value=" + value;
// this sends the name and value parameters to the scriptURL
$("<div/>").html(url);
}
$(document).ready(function(){
$(".toggleBox").bind("click", function(){
toggle($(this).attr("id"), $(this).is( :checked ));
});
});
</script>
<input type="checkbox" id="something" name="something" class="toggleBox" />
Ruby script:
...
require cgi
params = CGI.parse(request.query_string)
# params is now {"id"=>["id name"], "value"=>["true or false"]}
**Completed = p[ value ].first**
... rest of your code ...