小编mTu*_*ran的帖子

从Window.location.hash创建数组

我试图从window.location.hash变量创建数组但我很惊慌.

我的代码是:

        $.each(window.location.hash.replace("#", "").split("&"), function (i, value) {
            value = value.split("=");

            var my_item = {value[0] : value[1]};
            form_data[i] = my_item; 
        });
        console.log(form_data);
Run Code Online (Sandbox Code Playgroud)

谢谢.

javascript arrays jquery

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

通过Javascript将URL转换为HTTPS

我想用javascript将当前网址转换为https版本.我怎么能这样做?

例如:http://www.abc.com - > https://www.abc.com

javascript

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

在AngularJS表达式中调用全局变量

我在head的标签中有一些全局变量:

<script type="text/javascript">
    var apiRoot = 'http://localhost:8000/api',
        apiUrl = apiRoot,
        apiBadgeUrl = apiRoot + '/badges',
        apiLevelUrl = apiRoot + '/levels',
        apiBehaviorUrl = apiRoot + '/behaviors',
        apiTrophyUrl = apiRoot + '/trophies',
        apiUserUrl = apiRoot + '/users',
        apiWidgetPreferencesUrl = apiRoot + '/widgetPreferences';
</script>
Run Code Online (Sandbox Code Playgroud)

我想在html文件中使用角度表达式,但我的尝试失败:

{{ $window.apiRoot }} or {{ apiRoot }} 
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

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

如何使用nl2br显示一个换行符?

我nl2br()用来将\n字符转换为<br />标签,但我一次不想要多个<br />标签.例如,Hello \n\n\n\n Everybody应该成为Hello <br /> Everybody.

我怎样才能做到这一点?

php newline nl2br

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

检查jQuery AJAX请求状态

我通过jQuery做2个不同的ajax请求,我必须检查另一个是否有效.我怎样才能做到这一点 ?

我的ajax请求中的一个示例:

active_project_categories_ajax = $.ajax(
{
    url: "/ajax/get_skill_list",
    dataType: 'json',
    ......
});
Run Code Online (Sandbox Code Playgroud)

我需要这样的东西:active_project_categories_ajax.status()

javascript ajax jquery

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

Circle To Line通过HTML5 Canvas加入

我试图通过线加入每个圆圈,我的最终代码做了但它有一些像这样的对齐问题:

在此输入图像描述

我用红色圆圈标记了一些连接部分.如你所见,它们没有正确对齐(线条不会从圆心中出来).

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
        <canvas id="graph" width="982" height="636" style="width:491px">
        Taray?c?n?z Canvas Desteklemiyor !
        </canvas>

        <script type="text/javascript">
        var i = 0;
        var lastCoord = new Array();
        var c=document.getElementById("graph");
        var cxt=c.getContext("2d");

        function getParam(name)
        {
          name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
          var regexS = "[\\?&]" + name + "=([^&#]*)";
          var regex = new RegExp(regexS);
          var results = regex.exec(window.location.href);
          if(results == null)
            return "";
          else
            return decodeURIComponent(results[1].replace(/\+/g, " "));
        }

        function drawCircleAndLine(x, y)
        {           
            cxt.fillStyle="#000000";
            cxt.beginPath();

            if(i …
Run Code Online (Sandbox Code Playgroud)

html5 canvas html5-canvas

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

在MongoDB中逐日查询总用户数

我有“用户”集合,我想要每天的总用户数,例如:

01.01.2012 -> 5
02.01.2012 -> 9
03.01.2012 -> 18
04.01.2012 -> 24
05.01.2012 -> 38
06.01.2012 -> 48
Run Code Online (Sandbox Code Playgroud)

我为每个用户创建了 attritube。你能帮我查询一下吗?

{ 
  "_id" : ObjectId( "5076d3e70546c971539d9f8a" ),
  "createdAt" : Date( 1339964775466 ),
  "points" : 200,
  "profile" : null,
  "userId" : "10002"
}
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb

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

Windows上的Unicode setlocale和strftime失败

我有一个页面,它的编码是UTF-8,如果我尝试在unix系统中运行该代码,Everythings看起来很好但是当我尝试在windows(7)中运行时,一些字符看起来是问号( ).如何在两个系统中运行代码都很好(不使用iconv).

header('Content-Type: text/html; charset=UTF-8');
setlocale(LC_ALL, 'turkish');
echo strftime("%d %B %Y, %H:%M");
Run Code Online (Sandbox Code Playgroud)

php windows unicode strftime setlocale

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

关于jQuery选择器的问题

我想用jQuery选择除myclass之外的所有h1标签.例如,我想选择<h1>,但我不想选择<h1 class ="myclass">

谢谢

css jquery css-selectors

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

IE7 THEAD标签样式

此代码在IE8,Firefox,Chrome等中运行良好...但ie7无法识别此行:

.defaulttable thead {border-right:55px solid#c7c9cf;}

因为我在ie7看到没有边界.我怎么解决这个问题 ?

HTML:

<table id="search_table" class="mtm defaulttable">
   <thead>
     <tr class="sortlinks">
        <td>Hello 1</td>
        <td>Hello 2</td>
     </tr>
   </thead>
   <tbody>
       ...........................
</table>
Run Code Online (Sandbox Code Playgroud)

CSS:

.defaulttable {width:100%;border-collapse:collapse;}
.defaulttable thead td{font-weight:bold;background: url('/static/images/grey_fade_back.png') repeat-x 0 -2px;white-space:nowrap;}
.defaulttable thead{border-right:55px solid #c7c9cf;}
.defaulttable tbody td{border-right:1px solid #c7c9cf;}
.defaulttable td {border-top:1px solid #c7c9cf;border-bottom:1px solid #c7c9cf;border-left:1px solid #c7c9cf;padding:6px 8px 6px;}
.defaulttable .project_name{background-image:url('/static/images/mini/project.png');background-position:7px 7px;background-repeat:no-repeat;padding-left:30px}
.defaulttable .user{background-image:url('/static/images/mini/user.png');background-position:7px 7px;background-repeat:no-repeat;padding-left:30px}
.defaulttable .job_ad_title{background-image:url('/static/images/mini/pin.png');background-position:7px 8px;background-repeat:no-repeat;padding-left:30px}
.defaulttable .project_category div{}       
.defaulttable .odd{background:#EFEFEF url(/static/images/button-overlay.png) repeat-x scroll 0 0}
.defaulttable .hover{background:#FEFFAF url(/static/images/button-overlay.png) repeat-x scroll 0 0} …
Run Code Online (Sandbox Code Playgroud)

css internet-explorer-7 internet-explorer-6

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