我有这个代码:
<input type="hidden" id="editorTitle" name="title" value="home">
<textarea name="text" id="editorText"></textarea>
Run Code Online (Sandbox Code Playgroud)
但是,当我写,$('#editorTitle').val()
并且$('#editorText').html()
,$('#editorTitle').val()
'未定义'并且$('#editorText').html()
是空的?
怎么了?
编辑:
这是我的完整代码:
function openEditor() {
$("#editor").show().animate({ width: 965, height: 380 }, 1500);
$("#editor textarea").show();
}
function closeEditor() {
$("#editor").animate({ width: 985, height: 1 }, 1500, function () {
$("#editor").hide();
$("#editor textarea").hide();
});
}
function setedit() {
$.ajax({
type: "POST",
url: "engine.php",
data: "title=" + $('#editorTitle').attr('value') + "&text=" + $('#editorText').html(),
beforeSend: function () {
$('#mainField').html('<img src="data/images/loader.gif" alt="Loading...">');
},
success: function (msg) { …
Run Code Online (Sandbox Code Playgroud) 我有一个关于JavaScript对象属性名称的问题.查看下面的代码:
<!DOCTYPE html>
<meta charset="UTF-8">
<title>An HTML5 document</title>
<script>
var obj = {
123: 'go' // 123 is not a valid JavaScript name. No error here.
};
var obj2 = {
123a: 'go' // An Error occurred.
};
</script>
Run Code Online (Sandbox Code Playgroud)
如果JavaScript对象的属性名称是有效的JavaScript标识符,则不需要对象属性名称的引号.
例如
({go_go: 'go'}); // OK
({go-go: 'go'}); // Fail
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,123a
JavaScript名称无效,并且不会引用它.所以发生了错误.但123
也是一个无效的JavaScript名称,也没有引用,为什么没有错误?我个人认为123
必须引用.
谢谢!
最近我看了一些我在工作中致力于我们的版本控制系统的代码,我发现它已被替换了一堆(没关系),但旧版本仍在那里,注释掉了.
我猜这个家伙对于删除它感觉有点"不安全",因此将其留在那里注释掉了.但是,这并不是必需的,因为我们正在使用版本控制.(旧版本错了,所以它不会像以后那样需要.)
这些stackoverflow问题处理的问题是,是否留下这样的旧代码是一个好主意:
但是,我的问题是:这个问题是否有一个术语,或者在与同事谈论它时可以引用一个"反模式名称"?
我正在开发一个Android应用程序,根据Twitter和Facebook应用程序,我想在我的大多数活动中维持一个顶级的排序.这是怎么做到的?我想随时保留它,因为它将为整个应用程序提供功能核心.
我似乎无法理解Lua评估布尔值的方式.
这是一个旨在证明问题的简单片段:
function foo()
return true
end
function gentest()
return 41
end
function print_hello()
print ('Hello')
end
idx = 0
while (idx < 10) do
if foo() then
if (not gentest() == 42) then
print_hello()
end
end
idx = idx +1
end
Run Code Online (Sandbox Code Playgroud)
运行此脚本时,我希望在控制台上看到"Hello" - 但是,没有打印任何内容.有谁能解释一下?
使用MVC3/WebMatrix版本中的WebImage.从文件路径加载以下图像:
- 要么 -
针对它运行以下代码:
return new WebImage(path)
.Resize(120, 265)
.GetBytes("Png");
Run Code Online (Sandbox Code Playgroud)
在透明度被剥离并且使用黑色的图像中的结果:
RotateRight(),RotateLeft()和FlipHorizantal()也是如此.但是,如果我不调用.Resize()方法:
return new WebImage(path)
.GetBytes("Png");
Run Code Online (Sandbox Code Playgroud)
图像返回没有问题.
我们可以要求postgres对特定表使用缓存,并且根本不用于几个表吗?
在viewDidLoad中,我以编程方式创建了26个UILabel(字母表中每个字母一个),我将字母表中的字母放入每个标签中(第一个中的A,第二个中的B ......).
后来我想找到一个特定的标签(比如,包含字母"F"的标签).我知道我想要找到的字母及其在字母表中的索引(因此对于F,我知道它的索引是5,因为F是字母表中的第6个字母)
我怎样才能找到这个标签?
当然,我可以制作26个IBOutlets并参考它们,但这看起来很麻烦.
这是我创建标签的方式:
// set letters
letters = [[NSArray alloc] initWithObjects:@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z", nil];
int positionX = 0;
int positionY = 0;
for(int i = 0; i < [letters count]; i++) {
/* a lot of positioning stuff is here (positionX and positionY is set. I have removed this to make the code look …
Run Code Online (Sandbox Code Playgroud) 我有一个带有12 Gigs内存的双四核机器,我运行eclipse,有谁知道JVM Options会提供最具响应性/高性能的体验?
我目前正在运行:
-Xms256m -Xmx2048m -Xss2m -XX:PermSize =128米-XX:MaxPermSize参数=384米
将-Xmx更改为4096可以提供更好的性能吗?或者有更多的内存会降低性能?
我也可以让一个垃圾收集器在一个单独的核心上运行,以阻止在GC期间在UI中滞后吗?
我有一个viewFlipper在每个"翻转"中有不同的ListViews.我已经制作了所有列表registerForContextMenu(chosenList);
,并且longPress菜单出现在我想要的每个列表中.
现在我希望在不同的列表视图中有不同的contextMenues.例如.一个清单,网络信息将与网络相关的选择,在文本菜单和朋友列表会有另一组选择在它的文本菜单.
我该如何有效地做到这一点?这有可能吗?
public void onCreateContextMenu(ContextMenu menu2, menu3, menu4, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu2, menu3, menu4, v, menuInfo);
menu2.setHeaderTitle("Quick Menu");
menu3.setHeaderTitle("Menu3");
menu4.setHeaderTitle("Menu4");
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.context_menu, menu2);
inflater.inflate(R.menu.context_menu3, menu3);
inflater.inflate(R.menu.context_menu4, menu4);
}
Run Code Online (Sandbox Code Playgroud)
...要么 ...?能怎样?这开始让我在中脑疯狂......:D
android ×2
javascript ×2
c# ×1
caching ×1
contextmenu ×1
database ×1
eclipse ×1
html ×1
iphone ×1
jquery ×1
jvm ×1
listview ×1
lua ×1
performance ×1
postgresql ×1
sdk ×1
terminology ×1
uilabel ×1
undefined ×1