草庐IT

save_and_open_page

全部标签

javascript - Chrome 扩展上下文菜单 : how to append div to page after clicking menu item

尝试构建Chrome扩展程序。目前,我已经整理了一个上下文菜单项。单击上下文菜单项时,它会在我的后台脚本context_menu.js中触发itemClicked():functionitemClicked(info,tab){alert("clicked");}警报触发。我还可以做一些事情,比如通过itemClicked()发送ajax请求但是,我无法将任何元素附加到页面(或任何类型的DOM操作)。即使像这样基本的东西也不起作用:vard=document.createElement('div');d.setAttribute("css","width:100px;height:10

javascript - 我们可以使用 and 运算符来组合多个 jQuery 事件吗

我想使用jQuery查看三个文本框是否已更改,以便我可以通过AJAX发送数据。我尝试了一个简单的脚本:$("#name,#position,#salary").change(function(){console.log("Alldataarechanged");});其中name、position、salary是三个文本框各自的ID。结果是,当我更改第一个时:当我改变第二个时:这是第三个:因此,当每个文本框分别更改时,我收到了消息。我需要做的是当这三个改变时,显示消息。我是jQuery的新手,所以我想知道我是否可以在jQuery中使用类似IF...AND...AND的东西。

javascript - node_modules 文件夹上的 Github Pages 404

我正在尝试使用GitHub页面使用JavaScript在发布者-订阅者模块上呈现我的GitHub存储库。gh-pages分支看起来不错。但是,mustache代码不会呈现在我在GitHubPages上的项目中。它看起来像这样:GitHub存储库:https://github.com/ajhalthor/pubsub-application此项目的Github页面repo:https://ajhalthor.github.io/pubsub-application/GitHub存储库也有node_modules文件夹,所以它应该是自给自足的。Mustache、jQuery和Bootstr

javascript - "JavaScript placed at the end of the document so the pages load faster"是吗?

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:Javascriptonthebottomofthepage?我在一些推特Bootstrap示例中看到了一条评论。它说JavaScriptplacedattheendofthedocumentsothepagesloadfaster这是真的吗??如果是,那么它是如何工作的??

javascript - transclude : true and replace: true in Angular Js之间的基本区别

嘿,我是angularjs的新手,所以我正在浏览angularjs.org文档来制作自定义指令。我想知道transclude和replace之间的基本区别。我见过几个例子,其中他们使用transclude:true和replace:true作为自定义指令。抱歉,如果这是angularjs中的基本问题。只是让我的基础知识清楚。 最佳答案 当您使用transclude时,您将在您的页面上的自定义标签内包含任何可用的html。例如,如果您有:sometext段落标签将包含在您拥有的位置:template:'',因此您到页面的输出将显示为:

javascript - D3 : How do I set "click" event and "dbclick" event at the same time?

我已经将点击事件切换到一个节点,我还想将dbclick事件切换到它。但是,它只会在我点击它时触发点击事件。那么如何同时设置两个事件呢? 最佳答案 您必须进行“自己的”双击检测类似的东西可以工作:varclickedOnce=false;vartimer;$("#test").bind("click",function(){if(clickedOnce){run_on_double_click();}else{timer=setTimeout(function(){run_on_simple_click(parameter);},15

javascript - 是否有用于 Ember 数据的 'open' 本地存储适配器?

我计划使用localstorage来保存用户数据,并使用EmberData来管理个人网络应用程序的这些数据。我已经阅读了“EmberData”README.md,它可以为本地存储创建一个适配器。是否有可用的开放实现?我是GitHub的新手,找不到任何带有此类适配器的项目。 最佳答案 我创建了一个支持hasMany/belongsTo关联的localStorage适配器,它还有一个相当不错的测试套件:https://github.com/rpflorence/ember-localstorage-adapter

javascript - Protractor 和 Angular : How to test two pages in an app, 一个接一个?

我想在我的Angular应用程序的两个单独页面上运行Protractor测试:/dashboard和/articles。复杂的是我必须手动登录应用程序。目前我有这个设置:varLoginPage=function(){ptor=protractor.getInstance();this.login=function(url){ptor.get(url);ptor.findElement(protractor.By.model('email')).sendKeys(config.LOGIN_EMAIL);ptor.findElement(protractor.By.model('pass

javascript - 为什么 window.open(...).onunload = function () { ... } 不能像我预期的那样工作?

我希望能够知道我打开的窗口何时被用户关闭。这是我尝试对此进行监控的代码:window.document.onready=function(){document.getElementById('openWindow').onclick=function(){varwindowref=window.open('tests2.html');windowref.onunload=function(){window.alert('hola!');};};};OpenWindow我希望这会提醒“hola!”在用window.open打开的窗口关闭后的原始窗口中。相反,它会发出“hola!”的警报。

javascript - jQuery 用户界面 - 错误 : cannot call methods on dialog prior to initialization; attempted to call method 'open'

这个问题在这里已经有了答案:jqueryuiDialog:cannotcallmethodsondialogpriortoinitialization(11个答案)关闭6年前。[已解决]我写这个脚本。不幸的是,jQuery控制台抛出:Error:cannotcallmethodsondialogpriortoinitialization;attemptedtocallmethod'open'我使用jQuery1.10.2和jQueryUI1.10.4。$(function(){$("#player").on('click','img',function(){varzadanie=$("