本文发表在 rolia.net 枫下论坛<?php
ini_set('display_errors','On');
error_reporting(6135);
include"cred.php";
//$cpart=$_GET['cpart'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SmartNet Finder</title>
<link rel="STYLESHEET" type="text/css" href="_data/css/admin2.0.css">
<script language="javascript" type="text/javascript">
<!--
//Browser Support Code
function ajaxFunction(qcpt){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var cpt =qcpt;
var queryString = "?cpt=" + cpt;
ajaxRequest.open("GET", "smtDat.php" + queryString, true);
ajaxRequest.send(null);
//return false; //page not reload
}
//-->
</script>
</head>
<body >
<!-- <a href="#" onclick="errorbox('msg')">test</a> -->
<?
include"_header.php";
mysql_select_db('tmpDat');
$qsmpart=mysql_query("SELECT `part#` from smartnet
order by 1") or die('query smartparts error '.mysql_error());
?>
<table width="750" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="20"></td>
<td width="500">
<img src="_data/images/title_master_db_admin.gif" width="176" height="22" alt="Master Admin" border="0"><br>
<a href="master_db_admin.php">Back</a> | <font class="text_grey">Smartnet Finder</font>
<p><form name="cparts">
<strong>Cisco Part#</strong>
<select name="spart" onchange="ajaxFunction(this.value)">
<option value="">select here or type
<?php
while($r = mysql_fetch_array($qsmpart)){
?>
<option value="<?=$r[0]?>"><?=$r[0]?></option>
<?php
}?>
</select>
<input type="Text" name="cpart" size="29" >
<input type="Button" value="Go" onclick="ajaxFunction(this.form.cpart.value)">
</form></p>
<div id='ajaxDiv'>Your result will display here</div>
</td>
</tr>
</table>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net
ini_set('display_errors','On');
error_reporting(6135);
include"cred.php";
//$cpart=$_GET['cpart'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SmartNet Finder</title>
<link rel="STYLESHEET" type="text/css" href="_data/css/admin2.0.css">
<script language="javascript" type="text/javascript">
<!--
//Browser Support Code
function ajaxFunction(qcpt){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var cpt =qcpt;
var queryString = "?cpt=" + cpt;
ajaxRequest.open("GET", "smtDat.php" + queryString, true);
ajaxRequest.send(null);
//return false; //page not reload
}
//-->
</script>
</head>
<body >
<!-- <a href="#" onclick="errorbox('msg')">test</a> -->
<?
include"_header.php";
mysql_select_db('tmpDat');
$qsmpart=mysql_query("SELECT `part#` from smartnet
order by 1") or die('query smartparts error '.mysql_error());
?>
<table width="750" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="20"></td>
<td width="500">
<img src="_data/images/title_master_db_admin.gif" width="176" height="22" alt="Master Admin" border="0"><br>
<a href="master_db_admin.php">Back</a> | <font class="text_grey">Smartnet Finder</font>
<p><form name="cparts">
<strong>Cisco Part#</strong>
<select name="spart" onchange="ajaxFunction(this.value)">
<option value="">select here or type
<?php
while($r = mysql_fetch_array($qsmpart)){
?>
<option value="<?=$r[0]?>"><?=$r[0]?></option>
<?php
}?>
</select>
<input type="Text" name="cpart" size="29" >
<input type="Button" value="Go" onclick="ajaxFunction(this.form.cpart.value)">
</form></p>
<div id='ajaxDiv'>Your result will display here</div>
</td>
</tr>
</table>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net