小编Ste*_*ann的帖子

如何检查是否选中了复选框?

我正在使用jQuery Mobile构建移动Web应用程序,我想检查是否选中了复选框.这是我的代码.

<script type=text/javascript>
  function validate(){
    if (remember.checked == 1){
      alert("checked") ;
    } else {
      alert("You didn't check it! Let me check it for you.")
    }
  }
</script>

<input id="remember" name="remember" type="checkbox" onclick="validate()" />
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,它不会执行它.

请帮忙 !

----编辑-----这就是我现在所拥有的.

<DIV data-role="content" data-theme="g">
    <DIV class=ui-grid-g-login>
        <FORM method=post action=[$=PROBE(266)/] data-theme="C">
            <P>~DATA_ERROR~</P>
            <div id="mail" data-role="fieldcontain">
                <label for="mail">Email:*</label>       
                <input id="mail" name="mail" type="email" />
            </div>
            <div id="pass" data-role="fieldcontain">
                <label for="pass">Paswoord:*</label>        
                <input id="pass" name="pass" type="password" />
            </div>
            <div id="remember" data-role="fieldcontain">
                <label for="remember">Onthoud mij</label>       
                <input id="remember" name="remember" type="checkbox" …
Run Code Online (Sandbox Code Playgroud)

javascript checkbox jquery-mobile

165
推荐指数
9
解决办法
72万
查看次数

回到顶部使用Jquery Mobile

我正在使用jquery mobile构建移动webapp.现在我想做一个回到顶部的动作.通常你应该像下面的代码一样.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Body ID For Top Anchor Demo</title>
</head>

<!-- NOTICE: ID in Body Tag. -->
<body id="top">

<h1>
This Is My Demo
</h1>

<p style="margin-bottom: 3000px ;">
This paragraph has a huge ass bottom margin
so that the page will definitely scoll and
put the following link below the page fold.
</p>

<p>
<!--
This link will jump back up to the ID:top in
the document. Since that is …
Run Code Online (Sandbox Code Playgroud)

html css anchor jquery jquery-mobile

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

jquery-mobile ×2

anchor ×1

checkbox ×1

css ×1

html ×1

javascript ×1

jquery ×1