小编Sja*_*jay的帖子

使用JQuery检查单选按钮时显示隐藏的内容

我有两个复选框

ABC
XYZ
Run Code Online (Sandbox Code Playgroud)

当ABC被检查时,我正在显示abc内容div,当检查XYZ时,我正在显示xyz内容div

一切都很好,只有当我点击ABC和XYZ单选按钮时,假设是否默认ABC单选按钮被检查abc内容div不显示只有点击我正在获取它的内容

我的要求是当选中单选按钮时,我应该获得该特定选中单选按钮的隐藏内容而不是单击

有人可以帮助我实现它

http://jsfiddle.net/Qac6J/497/

HTML

<form id='group'>
    <div>

        <label>
            <input type="radio" name="group1" class="trigger" data-rel="abc" checked />ABC
        </label>

        <span class="abc content">
            <label>
                <span>I belong to ABC</span>
                <input type="button" value="ABC"/>
            </label>
        </span>

    </div>
    <br>
    <div>

        <label>
            <input type="radio" name="group1" class="trigger" data-rel="xyz"/>XYZ
        </label>

        <span class="xyz content">
            <label>
                <span>I belong to XYZ</span>
                <input type="button" value="XYZ"/>
            </label>
        </span>

    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

CSS

.content
{
    display: none;
}
Run Code Online (Sandbox Code Playgroud)

JQuery的

$('.trigger').change(function() 
{
    $('.content').hide();
    $('.' + $(this).data('rel')).show();
});
Run Code Online (Sandbox Code Playgroud)

html css jquery

5
推荐指数
1
解决办法
2066
查看次数

当用户在php中打开的一个选项卡中注销时,自动注销所有打开的选项卡

我正在研究php中的php会话概念.使用jquery和php创建登录页面,并在我登录会话运行时为所有页面创建会话我可以在另一个选项卡中打开登录的URL,但是我在登出时遇到问题.

当我在其中一个打开的浏览器选项卡中注销其他选项卡时,如果我刷新页面被注销,它仍会手动运行.我的要求是当我在其中一个选项卡中注销时,其他选项卡应该自动注销而不是手动注销.

DB文件

<?php
    session_start();
    $con = mysqli_connect("localhost", "root", "","testing") or die ("Oops! Server not connected"); // Connect to the host

?>
Run Code Online (Sandbox Code Playgroud)

的login.php

   <?php
    include 'db.php';
    if(isset($_SESSION['username']) && $_SESSION['username'] != '')
    { // Redirect to secured user page if user logged in

        echo '<script type="text/javascript">window.location = "userpage.php"; </script>';
    }
?>
<html>

    <body>
        <form>
            <table class="mytable">
                <tr>
                    <td>Username</td>
                    <td>
                        <input type="text" name="username" id="username" class="as_input" value="s"/>
                    </td>
                </tr>
                <tr>
                    <td>Password</td>
                    <td>
                        <input type="password" name="password" id="password" class="as_input" value="s"/>
                    </td>
                </tr>
                <tr>
                    <td></td>
                </tr> …
Run Code Online (Sandbox Code Playgroud)

javascript php session jquery tabs

5
推荐指数
1
解决办法
2992
查看次数

div 的 CSS 转换不应影响内容

我有外部 div 部分,在外部 div 内,我在鼠标悬停时有内部 div 部分,我只希望外部 div 部分应该是过渡,而内部 div 部分文本不应该过渡应该保持不变,有人帮助我实现它。

谢谢!

http://jsfiddle.net/zeYZL/56/

超文本标记语言

  <div class="outer">
        <div class='inner'>
            <p>inner text</p>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

CSS

 .outer
{
  width:283px;
  height:298px;
  float:left;
  background:#101820;
  color:#fff;
  font-family:Lato;
  font-weight:900;
  font-size:3.4em;
  text-align:center;
  line-height:298px;
  transition:all 0.3s ease;
}
.outer:hover
{
  -webkit-transform: scale(1.3);
  -ms-transform: scale(1.3);
  transform: scale(1.03);
  width:283px;
  height:298px;
  cursor:pointer;
  background-color:#ffa300;
}
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
2
解决办法
1980
查看次数

边栏导航和右侧显示内容

我想在右侧显示侧边栏导航(左侧菜单链接)和每个单击的垂直菜单显示的内容.

例如,假设我有左侧菜单:

  • 伦敦
  • 纽约

如果我点击伦敦链接,内容/页面应显示在右侧,同样显示纽约链接.

http://jsfiddle.net/J5nCS/717/

#header {
    background-color:black;
    color:white;
    text-align:center;
    padding:5px;
}
#nav {
    line-height:30px;
    background-color:#eeeeee;
    height:300px;
    width:100px;
    float:left;
    padding:5px;          
}
#section {
    width:350px;
    float:left;
    padding:10px;        
}
#footer {
    background-color:black;
    color:white;
    clear:both;
    text-align:center;
   padding:5px;      
}
Run Code Online (Sandbox Code Playgroud)
<div id="header">
<h1>City Gallery</h1>
</div>

<div id="nav">
London<br>
Paris<br>
Tokyo<br>
</div>

<div id="section">
<h2>London</h2>
<p>
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.
</p>
<p>
Standing …
Run Code Online (Sandbox Code Playgroud)

html css

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

使用 php/Mysql 中的选择查询将日期/时间从 24 小时格式转换为 12 小时 AM/PM

在php中使用mysql选择查询以12小时格式显示时间和日期。

数据库名称演示

表名学生

数据库结构

Id      firstname    lastname      pubdate
int(11) varchar(100) varchar(100)  timestamp
Run Code Online (Sandbox Code Playgroud)

我在学生表中插入了 5 条记录并使用选择查询显示一切正常,但我无法以正确的 12 小时格式显示发布日期!

请有人帮我实现它谢谢!

代码

$sql = "select id,firstname,lastname,pubdate from student";
$results = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($results))
{
   echo $row['id'];
   echo $row['firstname'];
   echo $row['lastname'];
   echo $row['pubdate'];

}
Run Code Online (Sandbox Code Playgroud)

php mysql

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

标签 统计

css ×3

html ×3

jquery ×2

php ×2

javascript ×1

mysql ×1

session ×1

tabs ×1