当我点击任何按钮时,它告诉我showElement未定义。我正在寻找创建一个名为showElement的可重用函数,只要我想通过传递该div的id来显示div,就可以调用它。我究竟做错了什么? https://jsfiddle.net/2taswyy6/20/
这是我的HTML:
<button onclick="showElement('div1')">
Show Div 1
</button>
<button onclick="showElement('div2')">
Show Div 2
</button>
<div hidden id="div1">Showing Div 1</div>
<div hidden id="div2">Showing Div2</div>
更新:这是我的jQuery:
function showElement(id){
$('#'+id).show()
}
答案 0 :(得分:0)
HTML:
module multiplication_tb;
reg clk, start, finish;
reg [15:0] mult_A, mult_B;
reg [31:0] R;
com_multiplication U0 (
.mult_A (mult_A),
.mult_B (mult_B),
.R (R)
);
/*ser_multiplication U1 (
.clk (clk),
.start (start),
.finish (finish),
.mult_A (mult_A),
.mult_B (mult_B),
.R (R)
); */
initial
begin
$display("time\t clk start finish");
$monitor ("%g\t %b %b %b %b %b %b", $time, clk, start, finish, mult_A,
mult_B, R);
#100 clk = 0;
mult_A =0;
mult_B = 0;
#10 mult_A = 2;
mult_B = 3;
#20 mult_B=2;
#10 mult_B=5;
#100 $finish;
end
always
#5 clk = !clk;
endmodule
jQuery的:
<button onclick="showElement('div1')">
Show Div 1
</button>
<button onclick="showElement('div2')">
Show Div 2
</button>
<div style="display:none" id="div1">Showing Div 1</div>
<div style="display:none" id="div2">Showing Div2</div>
答案 1 :(得分:-1)