View: 2966|Reply: 4
|
my javascrip not working
[Copy link]
|
|
sy mmg dah buntu sgt2 nih..tatau nape aku pnye koding nih x function..padahal sblm nih ok jer..cantek jer dia function..
so sy nk mntk tlg pakar2 programming kat cni..
<script language="JavaScript" type="text/javascript" src="jsfile.js">
</script>
<style type="text/css">
<!--
body {
background-image: url(bac.gif);
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body id="home">
<div id="container">
<!--Put all content in #container-->
<div id="watermark"><a href="#">ini link aku</a></div>
<!--Put Banner in this part-->
<div id="header"><div align="center"><img src="img/BANNER.png" width="800" height="170" /></div>
</div>
<!--#header end-->
<!--Navigation panel-->
<div id="sidebar">
<ul>
<li><a href="B-A.HTML">BAHAGIAN A</a></li>
<li><a href="B-B.HTML">BAHAGIAN B </a></li>
<li><a href="B-C.HTML">BAHAGIAN C</a></li>
<li><a href="B-D.HTML">BAHAGIAN D</a></li>
<li><a href="B-E.HTML">BAHAGIAN E</a></li>
<li><a href="B-F.HTML">BAHAGIAN F </a></li>
</ul>
</div>
<!--#sidebar end-->
<!--Put all the content inside this-->
<div id="content">
<h1>BAHAGIAN A</h1>
<div id="leftContent">
<!--All form part goes in here-->
<form method="post" action="final.html">
<fieldset>
<legend>Butiran Pemohon</legend>
<table id="table1">
<tr><td>Nama Penuh</td>
<td><INPUT TYPE="TEXT" NAME="nama" VALUE=""><BR></td>
</tr>
<tr><td>No Kad Pengenalan</td>
<td><INPUT TYPE="text" NAME="kadp" VALUE=""><BR></td>
</tr>
<tr><td>No Matrik</td>
<td><INPUT TYPE="text" NAME="matrik" VALUE=""><BR></td>
</tr>
<tr><td>No Telefon</td>
<td><INPUT TYPE="text" NAME="tpon" VALUE="">
(xxx-xxxxxxx)<BR></td>
</tr>
<tr><td>Fakulti</td>
<td><select name="fakulti">
<OPTION VALUE="" selected>--Pilih fakulti--</OPTION>
<option>FCSIT</option>
<option>FK</option>
<option>FSS</option>
<option>FSTS</option>
<option>FEB</option>
<option>FSKPM</option>
<option>PERUBATAN</option>
</select><BR></td>
</tr>
<tr><td>PROGRAM</td>
<td><INPUT TYPE="TEXT" NAME="program" VALUE=""><BR></td>
</tr>
<tr><td>TAHUN PENGAJIAN</td>
<td><select value="" name="tahunpengajian">
<OPTION SELECTED VALUE="">--Tahun Pengajian--
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select><BR></td>
</tr>
<tr><td>PENAJA</td>
<td><select value="" name="penaja">
<OPTION SELECTED VALUE="">--Penaja--
<option value="1">PTPTN</option>
<option value="2">JPA</option>
<option value="3">SPA SARAWAK</option>
<option value="4">YAYASAN SELANGOR</option>
<option value="5">YAYASAN PERAK</option>
<option value="6">YAYASAN NEGERI SEMBILAN</option>
<option value="7">YAYASAN SARAWAK</option>
<option value="8">TIADA</option>
<option value="9">LAIN-LAIN</option>
</select></td>
<tr>
<td>LAIN-LAIN (SILA NYATAKAN)</td>
<td><INPUT TYPE="TEXT" NAME="lainpenaja"></td></tr>
<tr><td>ALAMAT RUMAH</td>
<td><TEXTAREA NAME="alamat" ROWS="2" COLS="40"></TEXTAREA></td>
</tr>
<tr><td>JUMLAH BANTUAN</td>
<td><INPUT TYPE="TEXT" NAME="jumlah" VALUE=""><BR></td>
</tr>
<tr><td>SEBAB MEMOHON</td>
<td><TEXTAREA name="alasan" COLS="40" ROWS="2" id="alasan"></TEXTAREA></td>
</tr>
<tr><td><p></td></tr>
</table>
<p><input type="checkbox" name="agree"/>
Saya mengaku bahawa segala kenyataan di atas adalah benar. Saya faham pihak Universiti berhak menolak/menarik balik bantuan
dengan serta merta sekiranya maklumat diatas didapati salah dan saya akan membayar balik semua wang yang telah diberikan.</p>
<br />
<p><input type="submit" value="Submit" />
</fieldset>
</FORM>
<!--Form end-->
</div><!--#leftContent end-->
</div><!--#content end-->
<!--This is the part where to put copyright and disclaimer-->
<div id="footer"><p>Copyright <a href="#">Aen</a> & <a href="#">Theresa</a> asdad</div><!--#footer end--><!--#footer end-->
</div><!--#container end-->
</body>
</html>
tu tuk sy nyer html code..yg kat bwh nih sy pnye external js file. |
|
|
|
|
|
|
|
yg nih external js file..
function checkform(form)
{
if (form.nama.value == "") {
alert( "Sila masukkan nama anda." );
form.nama.focus();
return false;
}
if(form.kadp.value.search(/\d{13}/)==-1){
alert("Sila masukkan no kad pengenalan anda dengan betul.");
form.kadp.focus();
return false;
}
if(form.matrik.value.search(/\d{5}/)==-1){
alert("Sila masukan no matrik dengan betul");
form.matrik.focus();
return false;
}
if(form.tpon.value.search(/\d{3}\-\d{7}/)==-1)
{
alert("No telefon anda tidak sah.\r\nSila masukkan dalam format xxx-xxxxxxx.");
form.tpon.focus();
return false;
}
if (form.fakulti.options[form.fakulti.selectedIndex].value == ""){
alert("Sila pilih fakulti anda" );
form.fakulti.focus();
return false;
}
if (form.program.value == "") {
alert("Sila masukkan program anda");
form.program.focus();
return false;
}
if (form.tahunpengajian.options[form.tahunpengajian.selectedIndex].value == ""){
alert("Sila pilih fakulti anda" );
form.tahunpengajian.focus();
return false;
}
if (form.penaja.options[form.penaja.selectedIndex].value == "") {
alert("Sila pilih penaja anda." );
form.penaja.focus();
return false;
}
if (form.alamat.value == "") {
alert("Sila masukkan alamat anda");
form.alamat.focus();
return false;
}
if (form.jumlah.value == "") {
alert("Sila masukkan jumlah yang diperlukan");
form.jumlah.focus();
return false;
}
if (form.alasan.value == "") {
alert("Sila nyatakan sebab anda memohon");
form.alasan.focus();
return false;
}
if (!form.agree.checked) {
alert("Sila tanda kotak akuan jika bersetuju untuk teruskan");
return false;
}
return true;
} |
|
|
|
|
|
|
|
Tak nampak pun kat mana panggil function checkform.
Contoh :
<form action="final.html" method="post" onSubmit="checkform"> |
|
|
|
|
|
|
|
Post Last Edit by bangcak at 9-9-2010 08:42
try nih
-
- <object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/OX6aqKAfAW0?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/OX6aqKAfAW0?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
Copy the Code |
|
|
|
|
|
|
|
sila guna jslint.com untuk check javascript anda. |
|
|
|
|
|
|
| |
|