小编osh*_*nen的帖子

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

Javascript:检测警报框何时正常和/或关闭

如何检测javascript警告框何时正常和/或关闭?

javascript jquery

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

从锚标记中获取文本

我有以下锚标记

<a href="http://www.google.com/">Google</a>
Run Code Online (Sandbox Code Playgroud)

我知道如何从锚点获取href:

alert($(this).attr("href"));
Run Code Online (Sandbox Code Playgroud)

但是如何从锚标记中获取文本,即如何获得"Google"?

jquery jquery-selectors

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

按顺序使用asc和desc的变量

我明白我可以按照sql查询的顺序使用变量,如下所示:

order by 
case when @var1 = 'priority' then priority end desc,
case when @var2 = 'report_date' then report_date end asc
Run Code Online (Sandbox Code Playgroud)

但是我如何在asc和desc部分使用变量呢?

sql t-sql sql-server sql-server-2005

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

当onclientclick为false时停止触发onclick?

是否可以使用onclientclick按钮的属性进行客户端检查.如果检查返回true,则触发该onclick事件.如果客户端检查返回false,请不要触发该onclick事件.

那可能吗?

更新:

这2项工作:

Stops the form from submitting:
OnClientClick="return false;"
Run Code Online (Sandbox Code Playgroud)
Allows the form to submit:
OnClientClick="return true;"
Run Code Online (Sandbox Code Playgroud)

接下来的2个不起作用:

// in js script tag
function mycheck() {
    return false;
}

// in asp:button tag
OnClientClick="return mycheck();"
Run Code Online (Sandbox Code Playgroud)
// in js script tag
function mycheck() {
    return true;
}

// in asp:button tag
OnClientClick="return mycheck();"
Run Code Online (Sandbox Code Playgroud)

它同时提交表单.

这是为什么?

vb.net asp.net asp.net-3.5 onclientclick

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

使用jQuery更改浏览器地址栏URL

是否可以直接使用jQuery更改浏览器地址栏中的URL而无需刷新页面或重定向到更改的URL?

或者由于安全问题,这是不可能的?

例如,我有一个jquery.ajax驱动的列表,所以没有帖子后退/屏幕刷新.该列表具有分页元素.因此,对于第一页,浏览器地址栏中的URL是:

http://company/list.php?page=1
Run Code Online (Sandbox Code Playgroud)

如果我从列表的分页部分单击第2页,它将显示基于第2页的列表,但由于这发生了ajax样式而没有刷新/回发,浏览器URL保持在

http://company/list.php?page=1
Run Code Online (Sandbox Code Playgroud)

我希望能够将其更改为

http://company/list.php?page=2
Run Code Online (Sandbox Code Playgroud)

没有回发/重定向到新网址

这不可能吗?

ajax jquery

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

锚标签中的哈希值

如何加载页面并使其在加载页面的某个位置打开?

例如,假设我有page1.html,它有3个链接

<a href="page2.html#1">1</a>
<a href="page2.html#2">2</a>
<a href="page2.html#3">3</a>
Run Code Online (Sandbox Code Playgroud)

page2.html,我也有页面上的那些链接,即

<a href="page3.html#1">1</a>
<a href="page3.html#2">2</a>
<a href="page3.html#3">3</a>
Run Code Online (Sandbox Code Playgroud)

但是当我点击#2#3链接的page1.html,他们总是在页面的顶部开放,即使#2#3在关闭屏幕page2.html需要被向下滚动到待观察.

不确定我做错了什么.

html anchor

21
推荐指数
4
解决办法
9万
查看次数

父母与最近

为什么这样做:

$('.button_30').click(function(){
    $(this).closest('.portlet').find('.portlet_content').text("foo");
});?
Run Code Online (Sandbox Code Playgroud)

为什么这不起作用:

$('.button_30').click(function(){
    $(this).parent('.portlet').find('.portlet_content').text("foo");
});?
Run Code Online (Sandbox Code Playgroud)

其中html看起来像这样:

<div class="portlet portlet_30">

    <div class="portlet_header portlet_header_30">
        header content here
    </div>

    <div class="portlet_sub_header portlet_sub_header_30">
        <input type="text" class="textbox_30" />
    </div>

    <div class="portlet_content portlet_content_30">
        results go here
    </div>

    <div class="portlet_footer portlet_footer_30">
        <input type="button" class="button_30" />
    </div>

</div>

<div class="portlet portlet_30">

    <div class="portlet_header portlet_header_30">
        header content here
    </div>

    <div class="portlet_sub_header portlet_sub_header_30">
        <input type="text" class="textbox_30 />
    </div>

    <div class="portlet_content portlet_content_30">
        results go here
    </div>

    <div class="portlet_footer portlet_footer_30">
        <input type="button" class="button_30" />
    </div>

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

html jquery jquery-selectors

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

我可以从localhost测试paypal api吗?

更新1:

根据使用PayPal使用PHP的即时付款通知的教程,除非打开某些路由器端口,否则PayPal无法访问本地托管的网站.这是因为该网站IPN对所有PayPal API都是真的吗?

原始问题:

在我的笔记本电脑上,我有一个LAMP环境设置,当我在http://localhost上线之前使用创建网站.

对于一个新项目,我需要使用PayPal API.如果我将笔记本电脑连接到互联网,我是否可以使用localhost来测试PayPal API?或者我是否必须将我的网站上传到其他地方的LAMP主机?

你可能在想,这是一个多么愚蠢的问题,试试看它是否有效.我已经尝试了它并且没有用,我想在进入下一步之前排除这个问题.

php paypal paypal-sandbox

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

将HighCharts渲染为类而不是id?

我有以下工作正常:

$(document).ready(function() {

    get_data_for_chart();

    function get_data_for_chart() {
        $.ajax({
            url: 'get_data.aspx?rand=' + Math.random(),
            type: 'GET',
            dataType: 'json',
            error: function(xhr, status, error) {
                console.log(status);
                console.log(xhr.responseText);
            },
            success: function(results) { 
                var chart1;

                chart1 = new Highcharts.Chart( {
                    chart: {
                        renderTo: 'portlet_content_18',
                        defaultSeriesType: 'column'
                    }
                });

            }
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

HTML看起来像这样:

<div id="portlet_content_18">
Run Code Online (Sandbox Code Playgroud)

用户可以portlet在屏幕上动态选择他/她想要的内容.portlet出于比较原因,他/她也可以选择在屏幕上多次使用相同的内容.

因此,如果HTML最终成为:

<div id="portlet_content_18">
<div id="portlet_content_18">
Run Code Online (Sandbox Code Playgroud)

只有第一个div填充图表,第二个保持空白.我该如何解决这个问题?

javascript jquery jquery-selectors highcharts

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