小编Bhu*_*kar的帖子

如何使用jQuery或其他js框架上传字符串作为文件

使用javascript,我有一个字符串文件(带有ajax请求).

如何通过另一个ajax请求将其作为文件上传到服务器?

javascript ajax upload jquery extjs

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

使用Grunt和Django:最佳工作流程

Django从另一个人那里继承了一个网站,我正试图Grunt.js和它一起使用.我的app目录结构如下:

app_name
 |__ pages
 |__ settings
 |__ static
     |__ config.rb
     |__ css
     |__ Gruntfile.js
     |__ img
     |__ js
     |__ node_modules
     |__ package.json
     |__ sass
 |__ templates
 |__ etc
Run Code Online (Sandbox Code Playgroud)

我应该Gruntstatic目录中使用吗?- 即最好的做法Grunt是在文件夹的根目录中使用(在这种情况下是旁边app_name)?

当我上传css/scripts到制作时,我不希望它Gruntfile.js是可见的.

javascript django gruntjs

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

使用 jquery 选择的加载选项

我正在使用 JqueryAjax 在 Select 元素中加载选项。

<div>
    <select id="roleType" name="roleType" 
             onclick="loadRoleTypes();">
               <option value="s">Select</option>
     </select>
</div>
Run Code Online (Sandbox Code Playgroud)

JqueryAjax

function loadRoleTypes()
{           
    $('#roleType').empty().append('<option>select</option>');        
    $.ajax({
            url: '/ci/ajaxcall/loadRoles.php',
            dataType: 'json',
            type: 'POST',
            data: {"userCode": userCode},
            success: function(response) {
              var array = response.value;
              if (array != '')
              {
                for (i in array) {                        
                 $("#roleType").append("<option>"+array[i].ROLE_TYPE+"</option>");
               }

              }

            },
            error: function(x, e) {

            }

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

在这里,当我单击选择元素时,我将选项值作为下拉列表。但我无法选择特定选项。如何解决此问题

ajax jquery

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

使用doubletaptogo.js点击href ="#nav"下拉菜单会导致页面跳转

我有一个下拉使用导航自适应网页doubletaptogo.js,问题是,当我在点击#nav链接以显示下拉项这导致页面scroll down,因此menu现在是在top of the page.

这是页面:http://goligraphist.com.au/development

我发现当我remove allnav这个问题下面的内容得到修复但这显然不是一个选择.我是新来的javascript,这真的让我陷入困境,任何想法?

示例代码:

<nav id="nav" role="navigation"> 
   <a href="#nav" title="show menu" class="menu-button">
      <img src="img/menu.png" alt="menu icon">
   </a> 
   <a href="#" title="hide menu" class="menu-button">
     <img src="img/menu.png" alt="menu icon">
   </a> 
   <ul> 
      <li class="active">
         <a href="goligraphist.com.au/development">Home</a>
      </li>
      <li>
       <a href="#">Portfolio</a>
     </li> 
     <li> 
       <a href="#">Contact</a>
     </li> 
   </ul> 
 </nav>
Run Code Online (Sandbox Code Playgroud)

jQuery脚本:

<script src="js/doubletaptogo.js"></script> 
<script> 
  $( function() { 
      $( '#nav li:has(ul)' ).doubleTapToGo(); …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery drop-down-menu

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

Onclick似乎只工作一次

所以,我有这个问题,过去几天我一直试图修复它而没有运气.我正在使用Jquery.dotdotdot

有什么问题?

当我点击"Read More"它会扩展内容,当我点击"Read Less"它将隐藏扩展的内容.如果我点击"Read More"第二时间将无法正常工作.

的jsfiddle:

直播网站:

HTML:

<div class='article'>
<div class='articleheader'>Title</div>
<div id='article_$count' class='articlecontent'>
    <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-plugins

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

Android Studio找不到com.android.support:support-v4:19.1.0

我已经导入了一个项目Android Studio但是我得到了错误:

找不到com.android.support:support-v4:19.1.0.

我在哪里可以找到这个文件?我使用了导入项目Gradle.

我有Android Studio version 0.5.7最后一个android sdk和java 1.7u55.

java sdk android android-studio

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

未捕获的类型错误:无法读取未定义的属性“pageX”

我正在修改toucheventsjs。我在 eclipse 的 logcat 中遇到了这个错误。

document.getElementById("squareBracket").
    addEventListener("touchmove", touchHandler, false);
document.getElementById("squareBracket").
    addEventListener("touchend", touchHandler, false);

function touchHandler(e) {
 if (e.type == "touchstart") {
 alert("You touched the screen!");
  } else if (e.type == "touchmove") {
 // alert(e.changedTouches[0].pageX);
 // alert(e.changedTouches[0].pageY);
 } else if (e.type == "touchend" || e.type == "touchcancel") {
  alert('X :' + e.targetTouches[0].pageX); 
  alert('Y :' + e.targetTouches[0].pageY);
}
}
Run Code Online (Sandbox Code Playgroud)

如果我删除的注释iftouchmove,坐标弹出。但是,如果被注释了,我的logcat中就会出现错误。

javascript jquery android touchstart cordova

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

使用 Javascript 或 Jquery 完全隐藏框架集中的框架

请仔细阅读下面的 HTML 文件代码。
这里我尝试使用 jQuery 的切换功能。这里我的“content.HTML”页面切换工作正常。
当我单击任何图像或按钮时,我需要完全隐藏“topFrame”,并在再次单击它时取消隐藏它。

请帮助我我犯了错误的地方。我已经尝试了很多来实现这一点,但我做不到。

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
    <html>
    <head>
    <title>Frameset Example Title (Replace this section with your own title)</title>
    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    </head>

    <frameset rows="10%,90%" border="0" name="FrameName">   
    <frame  name="topFrame" src="menu_1.html" target="right"></frame>
    <frame name="menu" src="content.html" target="_self"></frame>

    <noframes>
    //....
    </noframes>

    </frameset>
    <script>
    $(document).ready(function(){
      $("button").click(function(){
         $('frame[name="topFrame"]').fadeToggle("slow");
        $("#top").toggle();
      });
    });
    </script>
    </html>
Run Code Online (Sandbox Code Playgroud)

内容.html

<html>
<head>
<title>HTML Frames Example - Content</title>
<style type="text/css">
body {
    font-family:verdana,arial,sans-serif;
    font-size:10pt;
    margin:30px;
    background-color:#ffcc00;
    }
</style>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>


</head>
<body>
<h1>Content</h1>
<br> …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

CKEditor 4:我可以定义多个插件目录吗?

是否有可能对我来说,配置CKEditor"search"在多个目录的插件?

我正在CKEditor使用基本文件,Bower并希望将我的自定义配置和其他插件保留在bower_components文件夹之外.

从文档中我可以看到,可以轻松地启用额外的插件,但我认为它假设插件都包含在主插件文件夹中 - 希望我错了!

javascript ckeditor

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

Getting views folder path

I am getting the views folder path with this: app_path()."/Views"

获取视图文件夹路径是否有更好或更可靠的方法?我的意思是,以防视图文件夹移动到其他地方,它仍然有效.

谢谢.

php laravel-4

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

使用函数`String()`和函数参数的目的是什么?

我正在读书'Singe Page Web Applications'.我遇到了以下示例:

// This is single pass encoder for html entities and handles
// an arbitrary number of characters
encodeHtml = function ( input_arg_str, exclude_amp) {
    var input_str = String( input_arg_str), regex, lookup_map;

    ...

    return input_str.replace(regex, function ( match, name ){
        return lookup_map[ match ] || '';
    });
};
Run Code Online (Sandbox Code Playgroud)

我想知道,使用String()带参数的函数的目的是什么input_arg_str.我知道通过使用String()函数我可以将不同的对象转换为字符串,但我从未遇到过使用这样的功能String().

我很好奇你对此的看法,并且非常感谢你的帮助.

javascript

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

我希望隐藏字段,如果它的值为空,则图像src也使用Javascript在HTML中

如果字段为空并且图像src也是如何隐藏html中的字段.使用java脚本.请建议

<div id="pagewrapper" >
    <div class="row" >
        <div class="column-half" style="width:500px">
            <div class="containerdiv" >

                <form:label path="file4Desc" type="text" value="" maxlength="50">
                </form:label>
                <form:input path="file4Desc" value="${agreement.file4Desc}" 
                    style="width:300px"/>
                <font color="red"><form:errors path="file4Desc" /></font>           
            </div>
        </div>
        <div class="column-half" style="width:13%">         
            <div class="containerdiv">
                <form:label path="filename3" type="text" value="" maxlength="50">
                </form:label>
                <a href="${pageContext.request.contextPath}/customer/viewDownload3/${agreement.agreementId}.htm">
                    <img src="${pageContext.request.contextPath}/resources/images/download3.gif" 
                                border="0"
                                title="Download this document"/>
                </a>

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

html javascript jquery

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