我有这个奇怪的问题:
以下是JavaScript函数
function calculateSum()
{
var e2 = document.getElementById('hotel_names');
var selValue2 = e2.options[e2.selectedIndex].value;
if (selValue2='1')
{
alert("helloworld");
}
else
{
alert("byeworld");
}
//function closes
}
Run Code Online (Sandbox Code Playgroud)
它捕获HTML元素选择的选项值并显示相应的消息......或者它应该是.无论选择如何,它总是显示1.
另一方面,以下工作.
function calculateSum()
{
var e2 = document.getElementById('hotel_names');
var selValue2 = e2.options[e2.selectedIndex].value;
alert(selValue2);
}
Run Code Online (Sandbox Code Playgroud)
每次从选择中选择一个选项时,第二个函数都会显示正确的数字.任何想法为什么第一个不起作用?
我想创建一个当一个列表继续另一个列表时成功的参数。
例如 ?-proceed_list([1,2],[2])。是或 True(无论编译器是什么)。
谁能帮我?
我有一张可以随键盘移动的照片.我想要的是当我将它移到另一个图像之上时,另一个图像消失了.我怎样才能做到这一点?到目前为止,这是代码,但它不起作用.提前致谢.
Image3是移动的,Image6是我想要消失的.
procedure TArmcutting.FormCreate(Sender: TObject);
begin
DoubleBuffered := true;
if Intersectrect (overlay, Image3.BoundsRect, Image6.BoundsRect) then
begin
Image6.Visible := False;
end;
end;
Run Code Online (Sandbox Code Playgroud)
编辑:谢谢大家的答案!