1.PHP
a.PHP -> HTML & JavaScript
額 超簡單,我也要寫= =~
html代碼中
代碼如下 復制代碼 <input type="" readonly="readonly" style='background-color:#DCDCDC' value=<?php echo $perinfo[ID];?> />JavaScript代碼中
代碼如下 復制代碼 <script type="text/javascript">b.PHP <-> MySQL
php代碼中
<?php
$dbcnx = @mysql_connect ( "localhost", "root", "1234" );
if (! $dbcnx) {
echo ("Unable to connect to the " . "database server at this time.");
exit ();
}
if (! @mysql_select_db ( "pms" )) {
echo ("Unable to locate the joke " . "database at this time.");
exit ();
}
mysql_query ( "SET NAMES 'GB2312'" );
$q=mysql_query("select * from ability where ALV = 1");
while($row=mysql_fetch_array($q)){
$array1[] = $row[AName];
}
?>
2.HTML
a. HTML -> PHP (POST方式)
html代碼中
代碼如下 復制代碼 <form id="form" name="form" method="POST" action="do.php">do.php 文件代碼中
代碼如下 復制代碼 <?phpb. HTML -> JavaScript
JavaScript代碼中 (可獲得,可更改)
<script type="text/javascript">
var te = document.getElementById("count");
te.value = 1;
</script>
3.JavaScript
a. JavaScript -> HTML (通用法, 未驗證)
JavaScript代碼中
代碼如下 復制代碼 <script type="text/javascript">
html代碼
代碼如下 復制代碼 <a id="a" href="ExportArticle.action?articles=(n)"/> b. JavaScript ->PHP
通過html的轉接
1.JavaScript代碼先給html
代碼如下 復制代碼<script type="text/javascript">
var i = 1;
var te = document.getElementById("count");
te.value = i;
</script> 2.html代碼給php
<form id="form" name="form" method="POST" action="do.php">
<input type="hidden" id="count" name="count" value="1"/>
<input type="submit" name="Submit" value="Search"/>
</form> 3.do.php接收到
<?php
echo $_POST['count'];
?>