Jump to content

ask about javascript in HTML ?

Guest lovexa

Recommended Posts

Guest lovexa

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><script language="javascript">function a(){ var ND = document.form1.Noidung.value; var chuoi= "",i=0; //Xử lý khoảng trằng đầu chuỗi if (ND.substring(i,i+1)==" ") while (ND.substring(i,i+1)==" ") i++; //Xử lý trước khi lưu dữ liệu if (chuoi.length ==0) { alert("Nội dung góp ý không được để trống!"); document.form1.Noidung.select(); return false; } else return true; }</script></head><body><form name="form1" method="post" action="" onsubmit="return a()" > <label> <textarea name="Noidung"></textarea> </label> <label> <input type="submit" name="Submit" value="Submit" /> </label> <p> <label></label> </p> </form></body></html>when i enter into the textarea and click on submit button,the message is also alert.please fix this problem.thanks !!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...