我的基本javascript代码在屏幕上显示两次警报。 我真的看起来很熟悉,但没有找到任何东西。
这是代码并在本地工作
<script type="text/javascript">
function validateForm()
{
var x = document.forms["formBasvuru"]["namesurname"].value;
if (x == null || x=="")
{
alert("First name must be filled out");
return false;
}
return false;
}
</script>
这是我的表格:
<div class="ContextConteyner">
<div class="ContextLeft DottedConteyner">
<div class="ContextTitle ITCAvantGardeStdMd">
Başvuru Yapın,
</div>
{if $send}
Mesajınız iletilmiştir.
{else}
<div class="ContextDetail">
<form action="#" id="theForm" name="formBasvuru" method="post" enctype="multipart/form-data" onsubmit="return validateForm()">
<div class="InputMConteyner">
<div class="InputConteynerText ITCAvantGardeStdMd">
Adınız Soyadınız
</div>
<div class="InputConteynerImage">
<input id="NameSurname_txt" name="namesurname" type="text" />
</div>
<div class="InputConteynerText ITCAvantGardeStdMd">
E-Posta Adresiniz
</div>
<div class="InputConteynerImage">
<input id="EMail_txt" name="email" type="text" />
</div>
<div class="InputConteynerText ITCAvantGardeStdMd">
Telefon Numarası
</div>
<div class="InputConteynerImage">
<input id="PhoneNumber_txt" name="phone" type="text" value="" />
</div>
<div class="InputConteynerText ITCAvantGardeStdMd">
Başvurduğunuz Pozisyon
</div>
<div class="InputConteynerImage">
<input id="Position_txt" name="pos" type="text" value="{$u}" />
</div>
<div class="InputConteynerText ITCAvantGardeStdMd">
CV göndermek için tıklayın
</div>
<div class="InputConteynerImage">
<input type="file" name="file" size="40">
</div>
</div>
可能是什么原因?我还保留了一个名为common的目录。这个公共目录有header.tpl和meta.tpl,以便在所有页面中使用它们。这个问题会成为问题吗?