Tag: jQuery的

存储从jquery中的php文件中获取的数据

我有一个运行简单jquery脚本的php文件: var text = $(“.hide”).text(); 当我重定向到其他页面时,我想知道如何存储这些数据

JQuery和Google Maps JS api没有合​​作

我真的很难尝试在同一个块中使用Google Maps API和JQuery API。我的页面是jspx(Spring),我需要JQuery以便我可以获取并解析google fusion表数据。 但是,当我将两个库声明在一起时,地图div将无法加载(如果我单独加载Google地图,则所有映射都可以正常工作)。 这是相关的代码: // 任何指针或想法都会对我有很大帮助,我甚至尝试通过JQuery在一个单独的JS块中检索deprivation stat,但是尽管我付出了努力,但是在页面加载时没有调用该函数。

如何将值传递给隐藏在jquery中使用attr

我使用按钮的数据值属性获取按钮值的值 var myvalue = $(this).attr(“data-value”); 我必须将“myvalue”传递给隐藏值 $(“#myhidden”).attr(“value”,”??????????????”); 当我通过“myvalue”时,它不是在接受

根据表单中的字段值输出实时计算

我想使用jQuery在表单中输出实时计算,但由于缺乏JS知识,我不知道从哪里开始。 我想知道是否有人可以帮助我吗? 这是我的字段值: Total Cost: $ 页面加载时,total_days将预先填入一个值。 cost_per_day将由用户输入。 我希望在用户输入表单时填充total_cost span,计算如下: total_days * cost_per_day = total_cost

将样式应用于在函数循环中生成的li

@nrabinowitz 我现在想知道如何在单击时将地图图标应用于上一节中创建的LI。 那可能吗? 我在下面尝试了代码,但不起作用。 function(I) { // within the scope of this function, // “thismarker” will work as expected var listid = I + 1; $(“”) .html(” + listid + ” + ” + data[I][3] + ‘ ‘ + data[I][4] + ” + data[I][2] + ”) .click(function(){ infowindow.close(); infowindow.setContent(contentString[I]); map.setCenter(markers[I].position); infowindow.open(map, markers[I]); }) .appendTo(“#leadsList ul”); […]

具有平滑滚动的固定标题的帐户

我有一个jQuery脚本使用我的网站上的一些平滑滚动,我有一个固定的位置标题,但我不知道如何考虑固定标题大小,因为当它向下滚动时,固定标题覆盖标题。 $(function () { $(‘a[href*=”#”]:not([href=”#”])’).click(function () { if (location.pathname.replace(/^\//, ”) == this.pathname.replace(/^\//, ”) && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $(‘[name=’ + this.hash.slice(1) + ‘]’); if (target.length) { $(‘html, body’).animate({ scrollTop: target.offset().top }, 1000); return false; } } }); }); 有人有什么建议吗?

.clone之后选择不工作

我正在克隆一个HTML块,然后将它附加到div。 var part = $(‘#parts_tpl’).clone(); $(‘#parts_tpl’).after(part); HTML包含一个表单,由于某种原因,选择框不会更新新克隆的HTML中的值。 如果我尝试更新原始选择框值,它会起作用。 我只是不使用新克隆的表单。 我确保新创建的选择框具有唯一的ID,名称等。这就是我这样做的方式: // increment ids and names for select tags $(‘#’ + content.attr(‘id’)).find(‘select’).each(function() { var id = $(this).attr(‘id’) + partID; var name = $(this).attr(‘name’) + partID; if ($(this).attr(‘id’)) { $(this).attr(‘id’, id); } if ($(this).attr(‘name’)) { $(this).attr(‘name’, name); } }); 这就是我的HTML看起来像: Part Specifications Remove Part Description   Estimated Year […]

在同一个类前面加上href

我的页面上有以下代码…… 有时可能会有更多的并且每个人都会有更高的索引号5,6,7等。 我想做的是使用javascript:change_product_photo(x)每个href实例javascript:change_product_photo(x) (其中x是索引)从change_product_link删除“_”但保留(x)索引 我的想法是首先为包含javascript:change_product_photo所有href添加一个类,然后用该类修改所有href; s但是我对如何执行此操作感到很遗憾。 这是我到目前为止所得到的…… $(“a[href*=’javascript:change_product_photo’]”).addClass(‘link_fix’); 现在我不知道如何从url中删除“_”。

jQuery DomWindow不适用于Twitter链接+链接的最后部分像普通链接一样工作

我在RSS显示器( http://www.javascriptkit.com/dhtmltutors/googleajaxfeed3.shtml )中使用此脚本( jquery DomWindow用于网页上的所有链接 ),我发现了两个奇怪的问题: 1)它适用于大多数链接,但不适用于Twitter状态的链接(例如http://twitter.com/IraHeatBeat/statuses/48228573173121024 ) – 它显示DOMWindow,但将其留空。 2)生成的RSS链接的最后一部分像普通链接一样工作(没有DOMWindow,只跟随链接)。 例如,PM体育的链接像普通链接一样工作: ERR Sport //USAGE SYNTAX: new rssdisplayer(“divid”, “rssurl”, numberofitems, “displayoptions”) new rssdisplayer(“ERR_sport”, “http://sport.etv.ee/xml/spordiuudised.php”, 12, “date”) The Basketball Jones //USAGE SYNTAX: new rssdisplayer(“divid”, “rssurl”, numberofitems, “displayoptions”) new rssdisplayer(“TBJ”, “http://feeds.feedburner.com/TheBasketballJones”, 5, “date”) PM Sport //USAGE SYNTAX: new rssdisplayer(“divid”, “rssurl”, numberofitems, “displayoptions”) new rssdisplayer(“PMsport”, “http://sport.postimees.ee//rss/”, 5, “date”) […]

使用asmx将图像从android phonegap上传到服务器

我正在尝试从phonegap应用程序(android)上传捕获/库图像,当我调用asmx web服务时出现连接错误,请注意移动和服务器在同一网络上 这是我的代码: File Transfer Example function getphoto(){ navigator.camera.getPicture(uploadPhoto,function(message) { alert(‘get picture failed’); },{ quality: 10,destinationType:navigator.camera.DestinationType.FILE_URI,sourceType:navigator.camera.PictureSourceType.PHOTOLIBRARY }); } function uploadPhoto(imageURI) { document.getElementById(“myimg”).src=imageURI; var options = new FileUploadOptions(); options.chunkedMode = false; options.fileKey=”recFile”; var imagefilename = imageURI; options.fileName=imagefilename; options.mimeType=”image/jpeg”; // var params = new Object(); //params.value1 = “test”; //params.value2 = “param”; //options.params = params; var ft = […]