我想选择我插入的元素after(),但我不能选择它.
在Firebug控制台我可以用$('.new-tree-node-close')得到<span.new-tree-node-close>,但在我的网页我无法得到它.
<ul>
<li class="tree-l2"><a class="reference internal" href="#">One</a></li>
<li class="tree-l2"><a class="reference internal" href="#">Two</a></li>
<li class="tree-l2"><a class="reference internal" href="#">There</a></li>
<li class="tree-l2-new">
<div class="new-tree-node-l2">New</div>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
$(document).ready(function() {
//When User click 'New',remove it and insert new input box and 'Close'
$('.new-tree-node-l2').click(function(event) {
$(this).parent(':last').after('<input name="" class="new-tree-node-title"><span class="new-tree-node-close">[Close]</span>');
$(this).remove();
});
//When user click the 'Close',do something..
$('.new-tree-node-close').click(function(event) {
alert("Do Something...");
});
});
Run Code Online (Sandbox Code Playgroud)
这里的所有setTimeout答案都不起作用!
我只想在两个函数之间等待几秒钟,如下所示:
do_fn1();
wait(5000);
do_fn2();
Run Code Online (Sandbox Code Playgroud) 我正在做一些工作,我以编程方式从OpenSearch文档中指定的站点下载图标,如果它是ICO格式,我需要提取第一个图像(现在).我能够毫无问题地读取ICO文件头并切出第一个图像文件.但是,在阅读了解释我发现的文件格式的维基百科条目后,如果图像是位图格式,那么该文件是不完整的(它缺少标题).所以我需要在将数据保存到文件之前重新构建此标头,但是我遇到了一些困难.
根据BMP文件格式的Wikipedia条目,标头长度为14个字节,应包含以下内容:
Offset Data0x0000"BM", for our intents and purposes0x0002Size of the bitmap file in bytes0x0006Dependant on the application creating the file0x0008Dependant on the application creating the file0x000AOffset of the image data/pixel array
我认为位图文件的大小(以字节为单位)将是提取图像的大小+标题的14个字节,但我不确定要写入0x0006,0x0008以及如何获取像素阵列的位置写入0x000A.
我已经读过几次这篇文章了,但我必须承认我的脑袋有点疼.这是我第一次做这种事情的经历.任何人都可以帮我解决如何获取像素阵列的位置吗?
我有一个无序列表,每个列表元素包含两个跨度(比如跨度A和跨度B).现在我需要格式化这些格式,以便它们在屏幕上水平放置,而跨度A始终位于跨度B的顶部.
Eg. spanAItem1 spanAItem2 spanAItem3
spanBItem1 spanBItem2 spanBItem3
Run Code Online (Sandbox Code Playgroud)
如何使用一些有创意的CSS来做到这一点?
是否可以在运行时确定这一点?
external.js 的内容:
function x() {
//can i get the path/name of the html file that included this js file?
//which is test.html
}
Run Code Online (Sandbox Code Playgroud)
test.html 的内容
脚本 src="external.js"
我试图使用此代码进行大量的ips测试:
ip_is = [i for i in range(256)]
ports = [i for i in range(1024,49152)]
return [str(i1)+"."+str(i2)+"."+str(i3)+"."+str(i4)+":"+str(p) for i1,i2,i3,i4,port in ip_is,ip_is,ip_is,ip_is,ports]
Run Code Online (Sandbox Code Playgroud)
问题是第3行是ip列表.如果有办法立刻完成所有工作或者如何以懒惰的方式制作一个?我在python上很漂亮:P.
谢谢您的帮助 :)
<form>
<input class="date-pick" type="text" value="2010/08/02" name="date" />
<table id="events_selection">
<tr>
<td>
<img src="/admin/ajax/image.php?filename=/media/immagini/danieledaniela/1.jpg&maxw=200" />
<select name="1">
<option value="0"> NESSUN EVENTO </option>
<option value="5">anelli</option>
<option value="8">ballo</option>
<option value="6">cerimonia in chiesa</option>
<option value="13">dettagli</option>
<option value="9" selected="selected"><strong>festa</strong></option>
<option value="4">gli sposi</option>
<option value="1">la sposa</option>
<option value="3">lancio del riso</option>
<option value="2">lo sposo</option>
<option value="11">preparazione sposa</option>
<option value="10">preparazione sposo</option>
<option value="7">ristorante</option>
<option value="12">varie</option>
</select>
</td>
<td>
<img src="/admin/ajax/image.php?filename=/media/immagini/danieledaniela/30.jpg&maxw=200" />
<select name="31">
<option value="0"> NESSUN EVENTO </option>
<option value="5">anelli</option>
<option value="8">ballo</option>
<option value="6">cerimonia in chiesa</option>
<option value="13">dettagli</option> …Run Code Online (Sandbox Code Playgroud) 我有一系列记录,并为其分配了ID.即
record1,record2,record3等
我正在尝试使用以下命令获取链接的ID: -
$("a.removeTier").live('click', function() {
var tier = $(this).attr('id').match('/\d+$/');
alert(tier);
});
Run Code Online (Sandbox Code Playgroud)
变量层应该只包含字符串中的数值.目前,我正在变为空.
有任何想法吗?
我一直在使用jQuery地址插件,它传递了一个可能导致的event.value /messages/inbox/.我希望能够把它变成Messages Inbox.
我不确定使用哪个正则表达式以及如何执行此操作.目前我有这个,但这对我来说太麻烦了.
var href = event.value != '/' ? event.value : '/wall/';
var title1 = href.replace('/', "");
var title2 = title1.replace('/', " ");
var myTitle = title2.replace('/', "");
$.address.title("My-Site | " + myTitle);
Run Code Online (Sandbox Code Playgroud) 我的网站上的所有图像都会在css旁边自动显示一个图标(参见下面的代码示例).对于某些链接,我想删除此图标.对于某些链接,我想要一个不同的图标.
所以我虽然css继承会这样做,但我似乎无法让它工作.
见例子.
a { background: url('http://www.veryicon.com/icon/preview/System/Icons%20for%20Developers/smiley%20Icon.jpg') no-repeat center left; padding-left: 50px; }
a.icon { background: auto; padding-left: 0px;}
.frown { background : url('http://www.talkparanormal.com/images/smilies/misc4/frown.jpg') no-repeat center left; padding-left: 50px; }
Run Code Online (Sandbox Code Playgroud)
<p><a href="#">test link</a></p>
<p><a href="#" tooltip="test icon" class="icon frown">test2</a></p>
<p><a href="#" tooltip="test icon" class="icon other">test2</a></p>
Run Code Online (Sandbox Code Playgroud)
第一个链接是普通站点图标.
第二个链接应该有缩进和不同的图像.第三个链接应该没有图像,也没有缩进..
任何人都可以阐明我能做些什么才能让它发挥作用?我有点担心使用!important,但我知道这将使它工作.