草庐IT

get_page

全部标签

javascript - 未捕获的语法错误 : Failed to execute 'postMessage' on 'Window' : Invalid target origin 'my_page' in a call to 'postMessage'

我有以下脚本父页面(pair_pixel_filter.php):window.addEventListener("message",function(e){$('#log').append("Receivedmessage:"+(e.data));},false);$('.photo-upload-btn').click(function(event){event.preventDefault();window.open($(this).attr("href"),"popupWindow","width=600,height=600,scrollbars=yes");});子页面$.

javascript - 如何为特定页面显示 page_action?

我在玩一些chrome扩展,我发现了这个例子:http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/pageaction_by_url/一切正常,但我想创建自己的扩展,我想在特定站点上看到page_action图标,而不是在其url中带有“g”的站点。所以我试着简单地改变这个脚本://Copyright(c)2011TheChromiumAuthors.Allrightsreserved.//Useofthissourcecodeisgo

javascript - 使 AJAX "get"功能同步/如何获得结果?

我遇到了$.get函数的问题。url包含JSON我的代码:xyz=null$.get('http://www.someurl.com/123=json',function(data){varxyz=data.positions[0].latitude;});alert(xyz);//somemorecodeusingxyzvariable我知道xyz会提示一个空结果,因为$.get是异步。那么有什么方法可以在这个get函数之外使用xyz吗? 最佳答案 get是一个快捷方式。您可以使用以下方法执行相同但同步的操作:varxyz=nul

asp.net - Page_ClientValidate 正在验证多次。

我遇到的问题是,验证摘要消息(警报)显示了两次。我想不通原因。请帮忙。这是代码functionvalidate()//javascriptfunction{if(typeof(Page_ClientValidate)=='function'){varisPageValid=Page_ClientValidate();if(isPageValid){}}} 最佳答案 问题是函数Page_ClientValidate需要一个输入参数,如果您没有指定输入,那么每个组名都会触发一次验证摘要。在您的情况下,该函数会触发两次:一次针对group

javascript - rails : How to get the current user's time zone when using Heroku

我使用以下方法将Heroku网站的时区设置为太平洋标准时间(PST):herokuconfig:addTZ=America/Los_Angeles用户的时间现在总是以太平洋标准时间为准——无论他们是否在太平洋标准时间时区。获取用户实际时区(即他们实际所在位置的时区)的最佳方法是什么?我猜这可以使用Rails(或Javascript?)而不是Heroku来解决。 最佳答案 有两种方法可以做到这一点。确实,您可以使用javascript获取他们当前的时间/时区。有可能是用户的电脑时间设置不正确,此时显示的时区将不正确。因为您使用的是Ra

javascript - JS/jQuery : Get depth of element?

在纯JavaScript或jQuery中获取元素深度的最简单方法是什么?“深度”是指它嵌套了多少元素,或者它有多少祖先。 最佳答案 怎么样:$('#my-element').parents().length 关于javascript-JS/jQuery:Getdepthofelement?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4710943/

javascript - 使用 phantom js 打印 PDF - @page 规则不起作用

我们正在使用phantomJS从网页(内部网站)打印PDF。我的问题不在于整个样式,而在于@page规则。@page规则中的所有样式均未应用。你知道这可能是什么吗?@page{size:auto;padding:0!important;margin:10mm!important;page-break-before:avoid;border:none!important;page-break-after:avoid;page-break-inside:avoid;overflow:hidden!important;box-sizing:border-box!important;@top-

javascript - Javascript(ES6)中的 'static get' 是什么意思?

这个问题在这里已经有了答案:HowdoImakea"publicstaticfield"inanES6class?(6个答案)关闭5年前。我现在需要知道在Javascript中这样的表达式是什么意思staticgetis(){return"custom-element";}我想static可能具有类似于Java或C++的行为,但我需要有关这些语法的更多信息。

javascript - Backbone.Models this.get() 是复制整个数组还是指向内存中的同一个数组

Person=Backbone.Model.extend({defaults:{name:'Fetus',age:0,children:[]},initialize:function(){alert("Welcometothisworld");},adopt:function(newChildsName){varchildren_array=this.get("children");children_array.push(newChildsName);this.set({children:children_array});}});varperson=newPerson({name:"T

php - file_get_contents 通过 php 失败,通过浏览器工作

我想要实现的目标:获取对API端点的请求,检索XML并随后解析结果。我正在发送一个file_get_contents请求来实现这一点。问题:`file_get_Contents`fails,error:Warning:file_get_contents(https://api.twitter.com/1.1/statuses/mentions_timeline.json):failedtoopenstream:Aconnectionattemptfailedbecausetheconnectedpartydidnotproperlyrespondafteraperiodoftime,o