我正在制作一个图像滑块,用于加载用户使用jQuery点击的图像.我在Chrome中工作得很好但是当我在firefox和IE中尝试它时根本没有加载图像.这是我的代码:
$("img.clickable").click( function() {
$("#image_slider").animate({opacity:1.0,left:200},"slow");
$("#image_container").attr("src",event.target.src);
ihidden = false;
});
Run Code Online (Sandbox Code Playgroud)
当我尝试在Firefox或IE中运行它时,它根本不加载图像.有任何想法吗?:)
从查看某些论坛软件将数据存储在数据库中的方式(例如,phpBB使用MySQL数据库存储几乎所有内容),我开始想知道为什么他们这样做?难道不能像使用xslt一样快速有效地存储论坛主题和帖子吗?或者至少将帖子存储在主题中?
我一直在寻找一个解决我遇到的问题的方法,一旦我认为我找到了修复它就行不通.问题是我有一个CustomAttriburte数组,我想将它们转换为它们的实际类型,所以我可以根据它们的类型将每个方法传递给不同的方法.例如:我有一个RangeAttribute和DisplayFormatAttribute的单独方法,我希望调用正确的方法.
我做了一个测试控制台应用程序,我有一个基类和2个子类,每个类都有各自的"DoSomething(T t)"方法.通过运行方法:"DoSomething(x as dynamic)"为我的数组中的每个元素调用正确的方法.
以下作品:
class Base{}
class ChildA : Base {}
class ChildB : Base {}
class Program {
static void Main(string[] args)
{
Base[] c = { new ChildA(), new Base(), new ChildB() };
Console.Out.WriteLine(DoSomething(c[0] as dynamic));
Console.Out.WriteLine(DoSomething(c[1] as dynamic));
Console.Out.WriteLine(DoSomething(c[2] as dynamic));
Console.ReadLine();
}
static string DoSomething(Base b) { return "Base";}
static string DoSomething(ChildA c) { return "ChildA";}
static string DoSomething(ChildB c) { return "ChildB";}
}
Run Code Online (Sandbox Code Playgroud)
这导致我想要的输出:
ChildA
Base
ChildB
Run Code Online (Sandbox Code Playgroud)
所以这可行,但在我的实际应用程序中,我得到一个RuntimeBinderException
我的代码是:
class Seeder {
public …Run Code Online (Sandbox Code Playgroud) c# ×1
casting ×1
dynamic ×1
forums ×1
javascript ×1
jquery ×1
mysql ×1
overloading ×1
php ×1
storage ×1