View Full Version : Giải dùm ḿnh bài toán này nhé ( dung html và javascript)
Tuandatc7
14-07-2008, 11:49 AM
http://i324.photobucket.com/albums/k345/tuandat_album/tuandatct7.gif
Khi ta nhập các thông tin vào các input type , nhấn add sẽ xuất ra DANH SÁCH SINH VIÊN (dùng tag talble nhé). Ubdate để cập nhật thêm
Nhờ mấy anh năm 2,3 giải giúp nhé . Thanks nhiều
khigiadano
14-07-2008, 12:10 PM
Theo ḿnh nghĩ th́ HTML + JAVASCRIP ko thoả măn nổi yêu cầu trên
HTML hên xui chỉ có thể ghi DATA lên file TEXT
C̣n các hệ DATABASE như excel, access th́ nó sẽ pó tay nếu ko nhờ vả đến ASP hay PHP
Ḿnh cũng có thử tạo 1 cái nhập data và lưu trên TXT nhưng cũng phải nhờ 1 chút qua PHP
c̣n xuất th́ chưa bít
demo : http://baoanh.vnnetwork.net/mail
Tuandatc7
15-07-2008, 10:42 AM
Minh cam on ban khigiado , bai cua ban minh cung có xem trong http://www.w3.org rồi .Cũng khá hay , nhưng bạn nói bài của ḿnh không dùng html+javascript để thơa măn yêu cầu bài toán th́ sai rồi . Dùng hàm functionv() của javascript cũng có thể làm ra mà
Đây là code ḿnh đă làm thử , nhưng chưa thành công đâu , v́ ḿnh cũng đang bắt lỗi , hehe :
<html>
<head>
<title> tuan dat @_@ </title>
<script>
function start()
{
frmnhap.masosinhvien.focus()
frmnhat.nh.disabled=true
}
function test()
var masosinhvien,hoten,ngaysinh,hinh;
masosinhvien=frmnhap.mssv.value;
hoten=frmnhap.ht.value;
ngaysinh=frmnhap.ns.value;
hinh=frmnhap.h.value;
if(masosinhvien="");
{
alert(" Ban quen nhap MA SO SINH VIEN roi !")
return;
}
if(hoten="")
{
alert("Ban quen nhap HO TEN roi !")
return;
}
if(ngaysinh="")
{
alert("Ban quen nhap NGAY SINH roi !")
return;
}
if(hinh="")
{
alert("Ban quen nhap HINH roi !"
return;
}
frmnhap.nh.disabled=false
}
var count;
count=1;
function writedata()
{
var masosinhvien,hoten,ngaysinh,hinh;
var phandau,phanthan,phanthem,phancuoi
masosinhvien=frmnhap.mssv.value;
hoten=frmnhap.ht.value;
ngaysinh=frmnhap.ns.value;
hinh=frmnhap.h.value;
Idmasosinhvien.innerHTML=masinhvien
Idhoten.innerHTML=hoten
Idngaysinh.innerHTML=ngaysinh
Idhinh.innerHTML=hinh
Idmasosinhvien.id="Idmasosinhvien"+count
Idhoten.id="Idhoten"+count
Idngaysinh.id="Idngaysinh"+count
Idhinh.id="IDhinh"+count
count++;
phanthan=Iddata.innerHTML
phandau="<table id=Iddata border=1 cellpadding=1 cellspacing=1 width=100% style='border-collapse:collapse'>"
phanthem="<tr>"
phanthem+="<td width=50% id=Idmasosinhvien style='font-family:tahoma;font-size:10pt;color:#336699;font-weidth:bold'>&nbns;</td>"
phanthem+="<td width=50% id=Idhoten style='font-family:tahoma;font-size:10pt;color:#336699;font-weidth:bold'>&nbns;</td>"
phanthem+="<td width=50% id=Idngaysinh style='font-family:tahoma;font-size:10pt;color:#336699;font-weidth:bold'>&nbns;</td>"
phanthem+="<td width=50% id=Idhinh style='font-family:tahoma;font-size:10pt;color:#336699;font-weidth:bold'>&nbns;</td>"
phanthem+="</tr>"
phancuoi="</table>"
Iddata.outerHTML=phandau+phanthan+phanthem+phancuo i
frmnhap.nh.disabled=true
frmnhap.mssv.value=""
frmnhap.ht.value=""
frmnhap.ns.value=""
frmnhap.h.value=""
}
</script>
</head>
<body onLoad=start()>
<form method="post" action=" -- tuandat ct7 ^_^ --" name="frmnhap">
<table width=100% border=1 cellspacing=1 cellpadding=1 style="border-collapse:collapse">
<tr>
<td width=100% colspan=2 style="font-family::times new roman;font-size=14pt;color:#808000;font-weidth:bold" align="center" bgcolor="#e6fff9">THEM SINH VIEN</td>
</tr>
<tr>
<td width="26%" style="font-family:times new roman;font-size=14pt;color:#808000;font-weidth:bold" align="center" bgcolor="#e6fff9">Ma So Sinh Vien</td>
<td width="26%" style="font-family:times new roman;font-size=14pt;color:#808000;font-weidth:bold"><input type="text" name="mssv" size="20"></td>
</tr>
<tr>
<td width="26%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="right">Ho va ten</td>
<td width="74%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"><input type="text" name="ht" size="20" onBlur="Test()"></td>
</tr>
<tr>
<td width="26%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="right">Ngay Sinh</td>
<td width="74%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"><input type="text" name="ns" size="20" onBlur="Test()"></td>
</tr>
<tr>
<td width="26%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="right">Hinh</td>
<td width="74%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"><input type="file" name="h" size="20" onBlur="Test()"></td>
</tr>
<tr>
<td width="26%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="right"></td>
<td width="74%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"><input type="button" value="Nhap" onClick="writedata()" name="nh"></td>
</tr>
<tr>
<td width="100%" style="font-family: Times New Roman; font-size: 14pt; color: #CC3300; font-weight: bold" align="center" colspan="2" bgcolor="#E6FFF9">DANH
SACH SINH VIEN</td>
</tr>
<tr>
<td width="100%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="center" colspan="2">
<table id=Iddata border="1" cellpadding="1" cellspacing="1" width="100%" STYLE="border-collapse:collapse">
<tr>
<td width="10%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="center" bgcolor="#E0E0E0">Ma so sinh vien</td>
<td width="10%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="center" bgcolor="#E0E0E0">Ho Ten</td>
<td width="25%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="center" bgcolor="#E0E0E0">Ngay Sinh</td>
<td width="25%" style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold" align="center" bgcolor="#E0E0E0">Hinh</td>
</tr>
<tr>
<td width="25%" id=Idhten style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"> </td>
<td width="25%" id=Idlop style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"> </td>
<td width="25%" id=Idhten style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"> </td>
<td width="25%" id=Idlop style="font-family: Tahoma; font-size: 10pt; color: #336699; font-weight: bold"> </td>
</tr>
</form>
</body>
</html>
ai cao thủ th́ replay giùm ḿnh cái .( Nhức óc v́ bài này,hix hix)
khigiadano
15-07-2008, 10:49 AM
làm đc th́ share ḿnh với nhá ^.^
Tuandatc7
15-07-2008, 11:00 AM
nói vậy là trốn tránh đó nha ! .help me cái .bài này hay đó
Tuandatc7
15-07-2008, 02:39 PM
Ḿnh c̣n một bài nữa nà` , cũng " phê" lắm .hehe .
ḿnh lấy nguyên bản gốc bằng tiếng anh luôn ha .
START :
The webpage, after loading, looks the same as the illustration in figure 2.
In the ilustration: 2 command buttons with labels: Start Counting and Check.
6 textfields are called text1, text2, text3, text4, text5, text6, counting from top to bottom and left to right.
http://i324.photobucket.com/albums/k345/tuandat_album/baitap4.gif
figure 2
http://i324.photobucket.com/albums/k345/tuandat_album/bai3.gif
figure 3
Write program for the webpage to meet the following:
- When clicking on the button Start Counting:
A random number (between 1 and 100) of o objects will appear in the text area text1, with maximum10 objects on each row. (see figure 3)
Text4, text5 and text6 are initialized by 0.
- When the button Check is clicked:
If the blank textfield text2 was correctly input the correct counting of o objects in text1,
then a message "Correct!" will appear in text3, and the counter in text4 is increased by 1. (figure 4)
Else, a message box will appear saying the correct count. The same message also displays in text3. The counter in text5 is increased by 1. (figure 5)
In both case, a random number of o objects (between 1 and 100) will appear in the text1 area.
- Text6 displays the correct percentage.
figure 4
http://i324.photobucket.com/albums/k345/tuandat_album/bai3-1.gif
figure 5
http://i324.photobucket.com/albums/k345/tuandat_album/baitap4-1.gif
khigiadano
15-07-2008, 03:21 PM
Cái trên là sao
Not hỉu ??
Tuandatc7
16-07-2008, 05:15 PM
Hồi sáng làm ra rồi nà .Nhưng không hiểu sao khi nhấn "Check" th́ nó kiêm luôn chức năng "Start" luôn. Bắt lỗi miết mà không ra (Chán thiệt)
Đây là đoạn code của bài 2 nà . dùng notepad play thử nhé :
<html>
<head>
<title> tuan dat </title>
<script language="javascript">
var correct=0 ;
var wrong=0;
var round_random_number;
var random_number;
random_number=Math.random();
round_random_number=Math.floor(random_number*100);
function first()
{
alert(" random number :"+round_random_number);
}
function start()
{
for(var i=0; i<round_random_number; i++)
{
if(i%10==0 && i != 0)
{
window.document.my_form.tuandat.value+="\n";
window.document.my_form.tuandat.value+="o ";
}
else
{
window.document.my_form.tuandat.value+="o ";
}
}
}
function test()
{
if(window.document.my_form.xuat.value==round_rando m_number)
{
alert("Ban da lua chon dung roi");
correct++;
window.document.my_form.a_correct.value=correct;
}
else
{
alert("Ban da lua chon sai roi");
wrong++;
window.document.my_form.a_wrong.value=wrong;
}
window.document.my_form.tuandat.value="";
random_number=Math.random();
round_random_number=Math.floor(random_number*100);
start();
}
</script>
</head>
<body onLoad = "first()" bgcolor="black font-color="red">
<form name = "my_form">
<center>
<h3 color=green >COUNTING </h3>
<br>
<input type="button" name="tuan_dat" value="Start Counting" onCLick = "start()">
<br>
<textarea rows="10" cols="21" name="tuandat" readonly="readonly"></textarea>
<br>
<b> How Many <b> <input type="text" name="xuat">
<input type="button" name="a_xuat" value="check" onClick="test()">
<br>
Correct <input type="text" name="a_correct" value="0" readonly="1"> Wrong <input type="text" name="a_wrong" value="0" readonly="1">
<br><br>
<b> The End .Thank your for visited my web</b>
</center>
</form>
</body>
</html>
Tuandatc7
17-07-2008, 06:56 PM
he , buồn v́ không có ai phê b́nh ư kiến ǵ hết.
bossnabito
17-07-2008, 07:07 PM
Biết th́ đă tham gia rồi ! Tội mỗi cái chả biết ǵ để nói hít ah` ^^ he he
Thanks bạn đă tham gia diễn đàn nhá ^^
Tuandatc7
17-07-2008, 07:24 PM
ờ hơ , chắc minh học trước các bạn .Zay chừng nào thảo luận về C he .
vBulletin® v3.8.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.