|
 |
|
ช่วยหน่อยครับ งง กับปัญหาง่ายๆ ที่ไม่เข้า jquery แสดงข้อมูลที่เลือก |
|
 |
|
|
 |
 |
|
ลองแก้ให้ทีครับ ต้องส่งพรุ่งนี้
index.php
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function() {
$('#show').click(function(){
$('#showtext').show();
})
});
</script>
<body>
<form action="index.php">
<select name="">
<option value="0">เลือกข้อมูล</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input name="test" type="button" id="show" value="ส่งข้อมูล">
</form>
<div id="showtext">คุณเลือก</div>
</body>
</html>
|
ประวัติการแก้ไข 2012-07-29 22:04:40
 |
 |
 |
 |
Date :
2012-07-29 22:04:15 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมนั่งดูโอลิมปิกถึงกลับสะดุ้งเฮือก ฮ่า ๆ ๆ เค้าสั่งมาวันไหนล่ะเนี่ยะ
ถ้าทำได้ตอนนี้ ก็ไม่ได้ทำจาก jquery เอาลองไปดู แต่ถ้า jquery ก็รอท่านต่อไปนะ 
Code (PHP)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<form action="index.php">
<select name="s">
<option value="0">เลือกข้อมูล</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input name="test" type="submit" id="show" value="lj'-hv,^]">
</form>
<div id=""> ข้อมูลที่ถูกเลือก <? echo $s;?></div>
</body>
</html>
|
 |
 |
 |
 |
Date :
2012-07-29 22:21:26 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (HTML)
<!DOCTYPE html>
<html>
<head></head>
<body>
<select id="Listmenu">
<option value="1">Menu 1</option>
<option value="2">Menu 2</option>
<option value="3">Menu 3</option>
<option value="4">Menu 4</option>
<option value="5">Menu 5</option>
</select>
<div id="txt"></div>
</body>
</html>
Code (JavaScript)
$(document).ready(function(){
$("#txt").text("กรุณาเลือกข้อมูล");
$("#Listmenu").change(function(){
var $location = $("#Listmenu").val();
$("#txt").text("คุณเลือกข้อมูล "+$location);
});
});
|
 |
 |
 |
 |
Date :
2012-07-29 23:07:26 |
By :
Krungsri |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับสำหรับข้อมูลทั้งสองท่าน แต่ มันรันไม่ขึ้นครับ ไม่ส่งค่าข้อมูล
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function(){
$("#txt").text("กรุณาเลือกข้อมูล");
$("#Listmenu").change(function(){
var $location = $("#Listmenu").val();
$("#txt").text("คุณเลือกข้อมูล "+$location);
});
});
</script>
</head>
<body>
<form action="index.php" method="get">
<select id="Listmenu" name="a">
<option value="1">Menu 1</option>
<option value="2">Menu 2</option>
<option value="3">Menu 3</option>
<option value="4">Menu 4</option>
<option value="5">Menu 5</option>
</select>
<input type="button" value="ส่งข้อมูล">
</form>
<div id="txt"></div>
</body>
</html>
|
 |
 |
 |
 |
Date :
2012-07-29 23:27:52 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ แต่ผมเอาโค๊ดมารัน เลือกข้อมูลแล้วไม่ขึ้นครับ
อันนี้แหละครับที่ผมต้องการ
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<script src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#txt").text("กรุณาเลือกข้อมูล");
$("#Listmenu").change(function(){
var $location = $("#Listmenu").val();
$("#txt").text("คุณเลือกข้อมูล "+$location);
});
});
</script>
<body>
<select id="Listmenu">
<option value="1">Menu 1</option>
<option value="2">Menu 2</option>
<option value="3">Menu 3</option>
<option value="4">Menu 4</option>
<option value="5">Menu 5</option>
</select>
<div id="txt"></div>
</body>
</html>
|
 |
 |
 |
 |
Date :
2012-07-30 14:41:58 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|