小编Dim*_*San的帖子

jQuery - Navbar悬停没有显示

我正在从头开始构建简单的Web模板.我使用旧式jquery在导航栏上悬停以显示列表<li>,但它仅适用于关于我们的列并且不在产品列上工作.

怎么了?我该怎么办?

HTML页面

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Template</title>
    <meta name="viewport" content="width=device-width" />
    <script src="<?php echo base_url();?>js/jquery-3.0.0.min.js"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/style.css">

    <script>
        $(document).ready(function(){
            $("#nav ol li").hover(function(){
                $("ol",this).show();   //when onmouseover  //ol ?? nav ol li ??????????
            },
            function(){  //when mouseout
                $("ol",this).hide();
            });
        });
    </script>
</head>
<body>
    <div id="wrapper">
        <div class="toptext">
            <span style="margin-left: 85%"><?php echo anchor("login","???????????");?></span>
            <span style="float:right;"><?php echo anchor("register/index","???????????");?></span>
        </div>
        <div id="header">
            <h1><p></p></h1>
        </div>
        <div id="nav">
            <ol>
                <li><a href="<?php echo base_url();?>index.php/home">Home</a></li>
                <li><a …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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

在 /var/log/tomcat 中的 Centos 7 中没有来自 Tomcat 的 catalina.out?

我用 安装了 Tomcat sudo yum install tomcat,然后我可以用sudo systemctl start tomcat.

但是,我无法找到catalina.out/var/log/tomcat(仅存在一些文件存在):

-rwxrwxrwx 1 tomcat tomcat 9171 Oct 25 15:37 catalina.2016-10-25.log
-rwxrwxrwx 1 tomcat tomcat    0 Oct 25 15:22 host-manager.2016-10-25.log
-rwxrwxrwx 1 tomcat tomcat    0 Oct 25 15:22 localhost.2016-10-25.log
-rwxrwxrwx 1 tomcat tomcat 1980 Oct 25 15:31 localhost_access_log.2016-10-25.txt
-rwxrwxrwx 1 tomcat tomcat    0 Oct 25 15:22 manager.2016-10-25.log
Run Code Online (Sandbox Code Playgroud)

我不更改 Tomcat 的任何配置,只是将其作为服务启动。

java linux logging tomcat

7
推荐指数
0
解决办法
1153
查看次数

如何隐藏特定片段中的操作栏

我有片段 A , B , C , D 。我想隐藏片段 D 中的操作栏。

我试过了getActivity().getActionBar().hide();,但没有用。

public class Profile extends Fragment {

    public Profile() {
        // Required empty public constructor
    }

    public static Profile newInstance(int instance) {
        Bundle args = new Bundle();
        args.putInt("argsInstance", instance);
        Profile profile = new Profile();
        profile.setArguments(args);
        return profile;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {

        getActivity().getActionBar().hide();


        // Inflate the layout for this fragment
        View profile = inflater.inflate(R.layout.fragment_profile, container, false);

        return profile;


    }

}
Run Code Online (Sandbox Code Playgroud)

java android-studio

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

具有正则表达式的Spring URI模板模式

嘿有人知道怎么能用@RequestMapping匹配这个URI"http:// localhost:8080/test/user/127.0.0.1:8002:8".

我尝试编写这段代码:

@RequestMapping(value = "/user/{id}", method = RequestMethod.GET, 
        headers = "Accept=application/xml")
public void test(@PathVariable("id") String id) {
    System.out.println(id);
    return null;
}
Run Code Online (Sandbox Code Playgroud)

但问题是,当我打印id时,值为:127.0.0也许是什么东西?

java spring spring-mvc

6
推荐指数
2
解决办法
4962
查看次数

Java:如何从资源文件夹中加载.properties?

我在IntelijWorkspace中有Manven项目,在/resources文件夹中,我添加了一个.properties名为的文件SBMessages.properties.现在,我试图从Java获取此文件,它总是抛出FileNotFoundException.以下是我项目的树:

在此输入图像描述

我的代码在SBConnector.class中获取.properties文件:

public void initialize() {
    SBMessages = new Properties();
    try {
        SBMessages.load(getClass().getResourceAsStream("/sb/elements/SBMessages.properties"));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

尝试调试,直接路径/target/classes/elements/SBMessages.properties而不是/resources/sb/elements/SBMessages.properties.

请帮我解决这个问题.

java maven

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

获取下拉列表的选定值

我有一个相当不同的 HTML 结构,我试图获取下拉列表的选定值,如下面的代码所示:

<div class="quantityDropdown quantityDropdown-cartItem">
    <select id="qtySelect-61224b70-7b26-11e6-91d5-6921d6fe7421" class="cart-quantity-picker"
            data-orderitem="61224b70-7b26-11e6-91d5-6921d6fe7421">
        <option value="1">1</option>
        <option value="2" selected="">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
    </select>
</div>
Run Code Online (Sandbox Code Playgroud)

我的代码返回null.

我想得到 2 作为我的值。正如您所看到的,该属性中没有值selected

var quantity = document.querySelector(".quantityDropdown select").getAttribute("selected");
Run Code Online (Sandbox Code Playgroud)

如何获取选项标签之外的值 2?

html javascript

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

IntelliJ IDEA 不理解 Hibernate 查询语言 (HQL)

当我在 IntelliJ IDEA 中使用 HQL 时,它总是突出显示我的 Hibernate 查询:

在此处输入图片说明

我知道如何禁用该突出显示,这已在此处进行描述

但我想知道 IntelliJ IDEA 中是否支持 HQL?有没有办法使用查询自动完成之类的东西?

也许是设置中的一个选项或一些插件。

hql intellij-idea

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

MongoError:第一次连接时无法连接到服务器

const express = require('express')
const app = express()   //initialised express. using express by requiring it.
//conecting the server to browsers
const bodyParser = require('body-parser')
const MongoClient = require('mongodb').MongoClient

var db

MongoClient.connect('mongodb://aryan:aryan@ds127938.mlab.com:27938/post-quotes', 
                    (err, database) => {
    console.log('inside')
    //We move app.listen() so that it boots up only when our database is connected; ony aftert that should it flag: listening
    if (err) return console.log(err)

    db = database
    app.listen(process.env.PORT || 3000, function()  {
    console.log('listening on 3000')
})
    db.collection('quotes').find().toArray( (err, results) => {
        console.log(results)
    }) …
Run Code Online (Sandbox Code Playgroud)

mongodb express

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

使用高斯算法的 2016 年 Java 复活节计算器

我正在使用高斯算法制作未来 10 年的复活节计算器。

除了几年之外,它似乎工作得很好。例如,它告诉您 2016 年的复活节将在 2016-03-27,但它将在 2016-05-01。与其他年份搭配效果很好。

这是我的代码:

public class EasterCalculator {
public static void main(String[] args) {
    EasterCalculator obj = new EasterCalculator();
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyy");

    for (int i = 2016; i < 2026; i++) {
        System.out.println("Easter  in " + i + " will be on " + obj.getEasterDate(i).format(formatter));
        System.out.println("Trinity in " + i + " will be on " + obj.getEasterDate(i).plusWeeks(7).format(formatter));
        System.out.println();
    }
}

public LocalDate getEasterDate(int year) {
    int a = year % 19;
    int …
Run Code Online (Sandbox Code Playgroud)

java algorithm

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

使用jQuery更改值

我有以下内容:

<span class="label-info">3</span>
Run Code Online (Sandbox Code Playgroud)

我有以下jquery

var replaceit = $(this).closest(':has(.label-info)').find('.label-info').text();
Run Code Online (Sandbox Code Playgroud)

变量的值始终是一个整数,但不总是3:

ie: 1, 2, 3, 4, 5.
Run Code Online (Sandbox Code Playgroud)

我已经尝试了很多方法,无法获得改变的价值.我的最新尝试是:

return $(this).closest(':has(.label-info)').html().replace(replaceit, (replaceit - 1)); 
Run Code Online (Sandbox Code Playgroud)

我的最终结果是从"lable-info"的当前值中减去1,并用这个新结果切换它.因此,基于3的值的新跨度将成为.

<span class="label-info">2</span>
Run Code Online (Sandbox Code Playgroud)

我该如何实现这一目标?

更新代码更清晰

HTML:

<div>
<span class="lable-info">3</span>
</div>

<div>
   <a class="accept_friend">accept</a>
</div>
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

    $(document).on("click", "a.accept_friend", function() { 
        var checkValue = $(this).closest(':has(.name)').find('.name').text();
        var removeit = $(this).closest(':has(.item)').find('.item').fadeOut();
        var replaceit = $(this).closest(':has(.label-info)').find('.label-info').text();
        $.ajax({
            url: '/includes/accept_friend.php',
            type: 'post',
            data: {checkValue},
            success:function(data){
            return removeit;
            $("a.remove_pending").text(function () {
            return ('.label-info').html().replace(replacei, replaceit); 
        });
    }
Run Code Online (Sandbox Code Playgroud)

笔记:

我没有使用id.我正在上课.有多个具有相同名称的类.所以我必须通过最近的电话.

javascript jquery

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