问题列表 - 第33756页

如何获得最近输入Jquery的值

我的页面上有多个按钮,具有相同的类.当我点击一个按钮时,我想获得最近输入框的值(请记住,我的页面上有多个输入框和按钮,具有相同的类).

我有:

    $(".deletepostbutton").click(function() {

            var deleteid = $(this).closest('.deleteid').attr('value');

  });


<div class="microblogpostactions">
     <input type="text"  name="deleteid" class="deleteid" value="'.$row['id'].'" />
     <a href="Javascript:void[0]" class="deletepostbutton">Delete</a>
     </div>

<div class="microblogpostactions">
     <input type="text"  name="deleteid" class="deleteid" value="'.$row['id'].'" />
     <a href="Javascript:void[0]" class="deletepostbutton">Delete</a>
     </div>
Run Code Online (Sandbox Code Playgroud)

当用户点击链接时,如何获取最近输入的值并使我的变量等于它?

jquery closest

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

jQuery:如何找出next()到达结尾的时间,然后转到第一个项目

我正在使用next()函数显示一系列元素.一旦我到达终点,我想转到第一个元素.有任何想法吗?

这是代码:

//Prev / Next Click
$('.nextSingle').click( function() {
    //Get the height of the next element
    var thisHeight = $(this).parent().parent().parent().next('.newsSingle').attr('rel');
    //Hide the current element
    $(this).parent().parent().parent()
        .animate({
            paddingBottom:'0px',
            top:'48px',
            height: '491px'
        }, 300) 
        //Get the next element and slide it in      
        .next('.newsSingle')
        .animate({
            top:'539px',
            height: thisHeight,
            paddingBottom:'100px'
        }, 300);
});
Run Code Online (Sandbox Code Playgroud)

基本上我需要一个"if"语句,说"如果没有剩下的'下一个'元素,那么找到第一个元素.

谢谢!

jquery next

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

其他源文件C++无法访问全局对象

我有一个ErrorLog类,用于编写和修改日志文件.我想在重大事件之前和之后写入它以进行调试,我只想ErrorLog在整个应用程序中使用该类的一个实例.我尝试ErrorLog通过放置将对象声明为全局对象

ErrorLog exe_log;
Run Code Online (Sandbox Code Playgroud)到一个头文件,所以它是accessbile到其他文件,但我一直收到一个错误,说它已经定义.是否有正确的方法来抵御全局对象?

c++ scope global-variables

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

手动登录用户

我正在一个drupal网站上工作,我允许用户在发布内容的同时登录.我已经成功地将电子邮件和密码字段添加到原始表单中,但我仍然不知道应该如何实际登录用户.(我的计划是在创建内容之前在验证步骤中执行此操作,以使登录用户所有者访问内容).

我可以在user.module API中找到三个以某种方式看起来正确的函数:

现在,我的问题是它是哪一个?我是否走在正确的轨道上?

drupal login login-script drupal-6

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

View的getWidth()和getHeight()返回0

我动态地在我的android项目中创建所有元素.我试图获得按钮的宽度和高度,以便我可以旋转该按钮.我只是想学习如何使用android语言.但是,它返回0.

我做了一些研究,我发现它需要在onCreate()方法之外的某个地方完成.如果有人能给我一个如何做的例子,那就太好了.

这是我目前的代码:

package com.animation;

import android.app.Activity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.Button;
import android.widget.LinearLayout;

public class AnimateScreen extends Activity {


//Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    LinearLayout ll = new LinearLayout(this);

    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(30, 20, 30, 0);

    Button bt = new Button(this);
    bt.setText(String.valueOf(bt.getWidth()));

    RotateAnimation ra = new RotateAnimation(0,360,bt.getWidth() / 2,bt.getHeight() / 2);
    ra.setDuration(3000L);
    ra.setRepeatMode(Animation.RESTART);
    ra.setRepeatCount(Animation.INFINITE);
    ra.setInterpolator(new LinearInterpolator());

    bt.startAnimation(ra);

    ll.addView(bt,layoutParams);

    setContentView(ll);
} …
Run Code Online (Sandbox Code Playgroud)

java getter android android-layout

487
推荐指数
12
解决办法
30万
查看次数

在获得输出后,如何阻止python.exe立即关闭?

有什么办法可以阻止python.exe在完成后立即关闭吗?它关闭的速度比我读取输出的速度快.

这是程序:

width = float(input("Enter the width: "))
height = float(input("Enter the height: "))
area = width * height
print("The area is", area, "square units.")
Run Code Online (Sandbox Code Playgroud)

python

32
推荐指数
5
解决办法
11万
查看次数

为什么编译器不能解析对模板函数的调用?

在下面的程序中,为什么编译器会为调用printMax模板函数而不是调用函数生成错误printMaxInts

#include <iostream>

template<class A>
void printMax(A a,A b)
{
   A c = a>b?a:b;

   std::cout<<c;
}

void printMaxInts(int a ,int b)
{
   int c = a>b?a:b;

   std::cout<<c;

}

int main()
{
   printMax(1,14.45);

   printMaxInts(1,24);
}
Run Code Online (Sandbox Code Playgroud)

c++ templates overload-resolution

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

C++ 03中的完美转发

如果你有这个功能

template<typename T> f(T&);
Run Code Online (Sandbox Code Playgroud)

然后尝试调用它,让我们说一个rvalue就好

f(1);
Run Code Online (Sandbox Code Playgroud)

为什么T不能被推导为const int,使得参数成为一个const int&因而可以绑定到一个rvalue?

c++ forwarding c++03

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

来自file:// url的Google Analytics

我们有一个基于html的基于HTML的应用程序框架的东西,并希望谷歌分析与它一起工作.我相信我们已经正确设置,以便_trackPageview在需要的地方手动调用.

但事情似乎没有得到报道.现在要么我没有正常工作,要么使用file://URL上的协议从javascript跟踪GA 默认违反了一些我不知道的跨域策略.

GA也可以通过本地html工作file://吗?或者我的GA使用有问题吗?

请注意,我们使用的域实际上并不存在.我们希望使用类似移动应用程序跟踪的功能,但需要使用JavaScript而不是本机库.为了做到这一点,它看起来你设置了一个假域,并告诉跟踪器应该报告哪个域.


在我的结尾<head>:

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXACCOUNTID-XX']);
  _gaq.push(['_setDomainName', 'myfake.domain.com']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = 'http://www.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
Run Code Online (Sandbox Code Playgroud)

在我们的JS框架中,我们称之为:

_gaq.push(['_trackPageview', '/some/path/here']);
Run Code Online (Sandbox Code Playgroud)

javascript google-analytics cross-domain

15
推荐指数
2
解决办法
8505
查看次数

枚举值隐藏在C#中

我有一个枚举,我想"隐藏"其中一个值(因为我添加它以供将来支持).代码是用C#编写的.

public enum MyEnum
{
   ValueA = 0,

   ValueB = 1,

   Reserved
}
Run Code Online (Sandbox Code Playgroud)

我不想允许使用此代码的人使用此值(MyEnum.Reserved).任何的想法?TIA

c# enums

3
推荐指数
2
解决办法
5774
查看次数