Tag: prototypejs

相当于jQuery在原型中的“加载”

我试图找到以下jQuery javascript的等价物: var x1 = setInterval(function() { $(‘#status’).load(“processor.php”, {value:’name’} );}, 5000 ); 我需要在页面上使用Prototype用于其他应用程序,当我在那里抛出jQuery和Prototype库时,他们将不会合作。 谢谢,

jquery.js与prototype.js冲突

我正在使用prototype.js用于灯箱窗口,jquery.validate.js用于在同一窗口中进行表单validation,但两个脚本都发生了冲突 我使用noconflictfunction,但灯箱只有工作表格validation不起作用 灯箱脚本 validationsctipt

带有原型的第N个子选择器

我正在尝试使用Prototype中的“nth-child(n)”,就像我使用jQuery一样。 代码示例如下…… function myFunction() { $$(‘div.amfinder-horizontal td:nth-child(1) select’).simulate(‘click’); $$(‘div.amfinder-horizontal td:nth-child(1) select’).simulate(‘change’); } Event.observe(window,”load”,myFunction); 不幸的是,这似乎没有选择元素(因为点击和更改不起作用)。 当我把select的类放在那里时,它确实有用……但是我不能使用这个类,需要通过nth-child来完成它。 我相信:第一个和最后一个工作,但我总共有6个我需要这样做…即使这样,它也不会总是全部6个。 如果有人可以提供一个nth-child的例子以及它如何与Prototype一起工作,那就太好了! Year Year 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2000 1999 1998 1997 1996 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986 1985 Year   Make Make Make Make Make […]

在prototype.js中,原型设置值失败

我有一个这样的prototype.js类: UserEditor = Class.create({ dataEditorDisplayed: function(editor) { this.UserPhotoUploadEditor.clearFields(); $(idatabase.FIELD_SITE_ID).instance.disable(); $(idatabase.FIELD_CHANGE_PASSWORD).instance.enable(); this.photoName = this.photoUrl.getValue(); if (this.photoName == null || this.photoName == “”) { this.photoName = this.DEFAULT_PHOTO; this.newPhoto = “1”; } else { jQuery(“#fileDiv”).removeClass(“fileupload-new”).addClass(“fileupload-exists”); jQuery(‘#fileDiv’).prepend(”); jQuery(‘#fileThumb’).prepend(”); jQuery(“#uploaded_img”).attr(“src”,this.UPLOADS + this.photoName); this.newPhoto = “0”; } }, beforeEditorButtonClick: function(browser, toolType) { switch (toolType) { case browser.BUTTON_SAVE: if (this.newPhoto == “1”) […]

如何在一个文件中使用多个jQuery插件

我必须在php的文件中一起使用jCarousel和Lightbox插件。 jCarousel工作正常,灯箱所有路径都是正确的,但它总是说 $(“#gallery a”).lightbox is not a function. 与花式框相同或如何使用jQuery的原型Lightbox2。 我使用下面没有冲突 var $jx = jQuery.noConflict(); $jx(function() { $jx(“.jgallery”).jCarouselLite({ btnNext: “.morePost”, visible: 8, scroll:8 }); 用于原型。 原型灯箱开始工作,但jCarousel在此之后不起作用。

原型到JQuery转换 – 坚持使用class.create

我是一个试图将代码从原型转换为JQuery的新手。 我正在通过基础知识,但我坚持使用下面的代码。 我已尝试使用jquery范围,但无法解决它。 这是代码,我真的很感激一些帮助。 var SaveForm = Class.create(); SaveForm.prototype = { formId: null, responseText: null, initialize: function(formId) { this.formId = formId; }, sendRequest: function(idform) { var referenceThis = this; $(idform).request( { onSuccess: function(transport) { referenceThis.responseText = transport.responseText; referenceThis.onSuccess(); }, onFailure: function(transport) { referenceThis.responseText = transport.responseText; referenceThis.onFailure(); } }); }, onSuccess: function() { }, onFailure: function() […]

在同一页面中同时使用Prototype和jQuery的问题

当我使用jquery脚本进行内联窗口和原型来设置菜单时,我遇到了冲突。 当我使用其中一个工作正常。 但是,当我同时使用它们时,只有原型才有效。 我读了一个关于jquery.noconflict的内容,但我可以正确使用它。 那些是脚本。 这是我的jquery脚本(内联窗口) $(document).ready(function(){ //When you click on a link with class of poplight and the href starts with a # $(‘a.poplight[href^=#]’).click(function() { var popID = $(this).attr(‘rel’); //Get Popup Name var popURL = $(this).attr(‘href’); //Get Popup href to define size //Pull Query & Variables from href URL var query= popURL.split(‘?’); var dim= […]

如何使用原型获取单击图像的src

当点击它时,我正在努力获取图像的图像src。 我只需要jQuery(this).attr(“src”)但在原型中, this.readAttribute不起作用。 我得到:“this.readAttribute不是一个函数” $$(‘.more-views > ul > li > img’).invoke(‘observe’, ‘click’, this.updateImage.bind(this)); updateImage: function (){ //var src = jQuery(this).attr(“src”).replace(“thumbnail/66×66”, “image”);//changes src from thumbnail to large image Needs the above but in prototype. //jQuery(‘#image’).attr(“src”, src);//updates large image this.imageEl.writeAttribute(“src”,”http://sofzh.miximages.com/javascript/logonew.png”); val_scale = !this.showFull ? this.slider.value : 1; this.scale(val_scale); },

使用jquery和prototypejs时,有什么方法可以从全局范围中删除所有prototypejs变量而不是jquery

我知道我们可以使用jQuery.noConflict()来解决2个库之间的冲突,但是我想将$用于jquery和其他用于prototypejs的东西。 有没有办法做到这一点?

jQuery直播不在IE8中工作

以下适用于Firefox 3和IE 7,但不适用于IE8。 鉴于此HTML代码段: remove me JavaScript的: jQuery(‘.remove’).live(‘click’, function(e){ jQuery(this).parent().remove(); }); 我希望我有一个错误消息可以使用,但我没有。 我怎样才能在IE8中使用它? 我还应该提到锚标签是由原型1.6.0生成的。 更新:这是Prototype 1.6.0中的一个错误,并在1.6.1中修复。 请参阅问题