首页 \ 问答 \ 提取外部javascript查询字符串/锚点值:file.js #foo = bar(Extract external javascript query string/anchor value: file.js#foo=bar)

提取外部javascript查询字符串/锚点值:file.js #foo = bar(Extract external javascript query string/anchor value: file.js#foo=bar)

http://mycloud.net/js/file.js#foo=bar

我正在尝试加载跨域javascript文件,并希望在查询字符串上传递变量。 我已经看到了上面使用的'#'方法,但我不确定如何从file.js中提取'foo'值。 没有服务器端帮助的任何线索如何处理这个?

谢谢。


http://mycloud.net/js/file.js#foo=bar

I'm trying to load a cross domain javascript file, and want to pass a variable along on the query string. I have seen the above '#' method used, but am unsure of how to extract the 'foo' value from within the file.js. Any clues how to handle this without the aid of server side help?

Thanks.


原文:https://stackoverflow.com/questions/2676653
更新时间:2023-04-01 22:04

最满意答案

看看你的if语句。 如果滚动大于或等于850,则检查它是否小于或等于650 ???

这是非常基本的if语句,仍然不确定你想要实现什么,那么我只能推荐这个

if(scroll >= 850){
    //Larger or Equal to 850    
} else if(scroll >= 650){
    //More than or equal to 650 LESS than 850
} else if(scroll >= 450) {
    //More than or equal to 450 LESS than 650
}.. BLAH BLAH.... else { };

这有意义吗? 看到这个小提琴


Look at your if statement. If scroll is bigger or equal to 850 then check if it's less than or equal to 650???

This is very basic if statements, still unsure of exactly what you want to achieve then I can only recommend this

if(scroll >= 850){
    //Larger or Equal to 850    
} else if(scroll >= 650){
    //More than or equal to 650 LESS than 850
} else if(scroll >= 450) {
    //More than or equal to 450 LESS than 650
}.. BLAH BLAH.... else { };

Does this make sense? See this fiddle

相关问答

更多
  • 我回滚代码后得到了这段代码。 之前的代码中某处可能存在css问题。 它现在按预期工作。 $(document).on('page:change', function () { if($('#infinite-scrolling').size() > 0) { $('.pagination').hide(); $('#load_more_photos').show(); $('#load_more_photos').on('click', function() { va ...
  • 你的电话会解除所有事件的束缚,而不只是一个。 你需要取消绑定一个实例。 它可以通过功能参考完成 var myScroll1 = function () { $(window).off("scroll", myScroll1) } $(window).on("scroll", myScroll1) 或命名空间 $(window).on("scroll.scroll1", function () { $(window).off("scroll.scroll1", myScroll1) }) Your ...
  • 我测试了以下语句,它确实有效。 $(function() { $("a").attr("href", "#123"); }); 如果我点击任何链接,毫无疑问,该位置实际上附加了#123。 我认为你的问题可能是,你的“.1”没有附加到一个锚对象。 在HTML规范中,只有超链接(和一些不相关的html标签)具有“href”属性。 这意味着,例如,你的.1实际上是一个
    ,那么,即使你把href属性赋予它,它也没有任何默认行为 ...
  • 问题在于你检查条件的方式,控制将永远达不到if语句,因为没有任何事件调用该语句,它应该在“post”按钮的点击中,参见下面的工作代码小提琴url- 你需要这样做 - $(function () { $("input.upb").change(function () { var fileName = $(this).val(); $('input.upb').attr("id", "added"); $(".added").html("Selec ...
  • $(this)是非常流行的构造之一,用于指示当前元素是焦点,可以在事件和选择器函数中使用。 这与JavaScript的this构造相同, this构造由jQuery的函数包装,以提供对jQuery函数的访问。 $(".user").click(function() { //Here $(this) will represent the element that was click with class .user }); 插件通常是作为jQuery的jQuery()函数的扩展而开发的,它们几乎不负 ...
  • 根据ClientScriptManager.RegisterStartupScript文档 ,脚本块应在页面加载完成后但在页面的OnLoad事件触发之前执行。 如果您碰巧在OnLoad事件中添加了文本框,那么选择器将永远不会看到找到控件。 无论哪种方式,您都应该检查脚本运行时是否存在控件。 您可以执行以下操作: console.log($("#txtname").length); //or alert($("#txtname").length); 如果长度不为0那么其他可能会覆盖您的readonly设置。 ...
  • 只需添加多个处理程序,它们将按您添加的顺序执行。 $(window).scroll(scrollHandlerOne); $(window).scroll(scrollHandlerTwo); function scrollHandlerOne(e) { // Do logic here // Executed first } function scrollHandlerTwo(e) { // Do logic here // Executed second } Just ad ...
  • 看看你的if语句。 如果滚动大于或等于850,则检查它是否小于或等于650 ??? 这是非常基本的if语句,仍然不确定你想要实现什么,那么我只能推荐这个 if(scroll >= 850){ //Larger or Equal to 850 } else if(scroll >= 650){ //More than or equal to 650 LESS than 850 } else if(scroll >= 450) { //More than or equal to ...
  • 找到了解决方案。 我不得不在css中删除我身体标签上的“身高100%”现在一切正常! Found the solution. I had to remove 'height 100%' on my body tag in css All works fine now!
  • 建议使用jQuery.data()可以读取的data-属性
    得到 alert( $('#test').data('foo')) 组 $('#test').data('foo','new value, or object or array')) 不必存在使用此属性的属性。 您可以随时在元素上存储任何内容,也可以在标记中读取数据。 jQuery.data()API文档 Suggest using data- attributes t ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)