<div id="inputs">
<input type="text" value="">
<input type="text" value="">
</div>
<input type="button" id="add" value="Add input">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(function(){
$('#add').click(function(){
$('#inputs').append('<input type="text" value="">');
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我想为使用按钮生成的每个新输入添加搜索图标(id = add;为简单起见,此处未显示).这将是一个典型的输入:
<label>
<input type="text" class="search" name="word" autofocus="autofocus" />
<span class="search-icon">
<span class="glass"></span>
<span class="handle"></span>
</span>
</label>
Run Code Online (Sandbox Code Playgroud)
使用CSS,我可以以固定的方式定位搜索图标.
谢谢
我需要将“h4ppy c0d1ng”转换为“H4PPY C0D1NG”。我是这门语言的初学者,但这是我的尝试(ubuntu i386 VirtualBox Mac)。我认为 int 21h 是错误的,除了程序在执行时不会完成或打印字符串:
section .text
GLOBAL _start
_start:
mov ecx, string
mov edx, length
call toUpper
call print
mov eax, 1
mov ebx, 0
int 80h
;String in ecx and length in edx?
;-------------------------
toUpper:
mov eax,ecx
cmp al,0x0 ;check it's not the null terminating character?
je done
cmp al,'a'
jb next_please
cmp al,'z'
ja next_please
sub cl,0x20
ret
next_please:
inc al
jmp toUpper
done: int 21h ; just leave toUpper (not working)
print: …Run Code Online (Sandbox Code Playgroud) 我有以下代码打印传递给./main. 注意fmt的rodata部分。我已经包含了新行\n,就像在C 中一样,但它没有打印新行,而是打印:
参数数量:1\n
我的代码是:
;main.asm
GLOBAL main
EXTERN printf
section .rodata:
fmt db "Number of parameters: %d \n", 0
section .text:
main:
push ebp
mov ebp, esp ;stackframe
push dword[ebp+8] ;prepara los parametros para printf
push fmt
call printf
add esp, 2*4
mov eax, 0 ;return value
leave ;desarmado del stack frame
ret
Run Code Online (Sandbox Code Playgroud)
我知道在 0 之前和“Number ...”之后包括一个 10fmt会打印它,但我想printf这样做。我用NASM组装代码,然后通过GCC链接它以创建我的可执行文件。