只有第一个函数有效,它被阻塞在那里,它不做下一个,我试图改变函数的顺序,同样的事情发生了,它只执行它找到的第一个函数如果有人可以帮忙我我会很感激
protected void Page_Load(object sender, EventArgs e)
{
vehicleVial("\res\Foto.jpeg", "2", "0000BBB");
vehicleVial("\res\a.jpg", "1", "0000BBB");
}
public void vehicleVial(string foto, string vial, string matricula)
{
ClientScript.RegisterStartupScript(this.GetType(), "Popup",
string.Format("vehicleVial('{0}','{1}','{2}','{3}');",
foto, vial, DateTime.Now, matricula),
true);
}
然后我在javascript类中有这个函数
function vehicleVial(foto, vial, fecha, matricula) {
if (vial == 1) {
document.getElementById('vial1').outerHTML = `
<div class="col-2 nopadding" style="width:19%" id='vial1'>
<div class="card">
<ul class="list-group list-group-flush text-center">
<li class="list-group-item"><i class="fas fa-video" style="color:green"><span class="text-secondary ps-1">Vial 1 Sortida</span></i></li>
</ul>
<img class="card-img-top" src="`+ foto + `" alt='Vial 1' ondblclick='openImg(this)' />
<ul class="list-group list-group-flush">
<li class="list-group-item"><i class="fas fa-car-side fa-lg"><span class="text-secondary ps-1">`+ matricula + `</span ></i ></li >
<li class="list-group-item"><i class="fas fa-calendar fa-lg"></i><span class="ps-1 text-secondary badge badge-light">`+ fecha + `</span></li>
</ul>
</div>
</div>`;
}
else if (vial == 2) {
document.getElementById('vial2').outerHTML = `
<div class="col-2 nopadding" style="width:19%" id='vial2'>
<div class="card">
<ul class="list-group list-group-flush text-center">
<li class="list-group-item"><i class="fas fa-video" style="color:green"><span class="text-secondary ps-1">Vial 2</span></i></li>
</ul>
<img class="card-img-top" src="`+ foto + `" alt='Vial 1' ondblclick='openImg(this)' />
<ul class="list-group list-group-flush">
<li class="list-group-item"><i class="fas fa-car-side fa-lg"><span class="text-secondary ps-1">`+ matricula + `</span ></i ></li >
<li class="list-group-item"><i class="fas fa-calendar fa-lg"></i><span class="ps-1 text-secondary badge badge-light">`+ fecha + `</span></li>
</ul>
</div>
</div>`;
}
}