.cube{
position:absolute;demo.html
width: 100px;
height: 100px;
display: block;
background-color :#665544;
top: 50px;}
<html>
<head><title>demo</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" language="javascript"> google.load("jquery", "1.4"); </script>
<link rel="stylesheet" href="demo.css" type="text/css" media="screen"/>
<script type="text/javascript" src="demo.js"></script>
</head>
<body>
<div id="cube" class="cube">cube</div>
</body>
</html>
demo.js
$(document).ready(function() {
$("#cube").click(function(){
$("#cube").css("background-color","gray");
$.post('msg.php', {
text: 'hello word',
number: 23
}, function() {
alert('Your data has been saved.');
});
});
});
msg.php
<?php
$getValue=$_POST['text'];
echo $getValue;
?>
p.s.請用firefox 的plugin firebug 觀看結果,比較方便些
沒有留言:
張貼留言