you can use Ajax. for example//javascript
var xml_get_ip;
var get_ip=function(){
if(window.XMLHttpRequest){
xml_get_ip=new XMLHttpRequest();
}else if(typeof ActiveXObject != "undefined"){
xml_get_ip=new ActiveXObject("Microsoft.XMLHTTP");
}xml_get_ip.open("POST","get_id.php",true);xml_get_ip.onreadystatechange=_get_state;xml_get_ip.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xml_get_ip.send(null);}var _get_state=function(){if(xml_get_ip.readyState==4){//show the response content, the responseText is all of the content you should use.
alert(xml_get_ip.responseText);
}
}//I think you should know that how to deal the responseText.// if you still have problems, send mail to me: [email protected]
var xml_get_ip;
var get_ip=function(){
if(window.XMLHttpRequest){
xml_get_ip=new XMLHttpRequest();
}else if(typeof ActiveXObject != "undefined"){
xml_get_ip=new ActiveXObject("Microsoft.XMLHTTP");
}xml_get_ip.open("POST","get_id.php",true);xml_get_ip.onreadystatechange=_get_state;xml_get_ip.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xml_get_ip.send(null);}var _get_state=function(){if(xml_get_ip.readyState==4){//show the response content, the responseText is all of the content you should use.
alert(xml_get_ip.responseText);
}
}//I think you should know that how to deal the responseText.// if you still have problems, send mail to me: [email protected]
解决方案 »
- 南京的phper,来晒晒你们的工资
- 学php这么处还是第一次接触try- catch来处理异常,请朋友告知
- php中http和https头信息的发送方式是不同的吗?
- 在任何网页都可以发表评论
- 怎么在PHP中嵌入确定筐?谢谢 小弟在线等
- 我刚开始学习PHP,请问大家PHP和ASP哪个更容易上手?
- 救命啊!有关日文表单提交后产生的乱码问题!在线等待!!!
- 请教怎么可以把文件名改成以中文命名????????
- 俺最近想好好研究一下apache,睡能推荐本好书?
- 请教一个php用imagick将pdf转图片报错问题
- 急急急!!!linux系统按自然排序的文件名遍历怎么不行
- 用DOM怎么取得 增加 修改xml属性值(问题解决 分全给 在线等)
xml_get_ip.open("POST","get_id.php",true);
<html>
//javascript
var xml_get_ip;
var get_ip=function(){
if(window.XMLHttpRequest){
xml_get_ip=new XMLHttpRequest();
}else if(typeof ActiveXObject != "undefined"){
xml_get_ip=new ActiveXObject("Microsoft.XMLHTTP");
}xml_get_ip.open("POST","get_id.php",true);xml_get_ip.onreadystatechange=_get_state;xml_get_ip.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xml_get_ip.send(null);}var _get_state=function(){if(xml_get_ip.readyState==4){//show the response content, the responseText is all of the content you should use.
alert(xml_get_ip.responseText);
}
}
<script>
</script><body onload="get_ip()">
<!-- .......-->
</body>
</html>
<html>
<script>
//javascript
var xml_get_ip;
var get_ip=function(){
if(window.XMLHttpRequest){
xml_get_ip=new XMLHttpRequest();
}else if(typeof ActiveXObject != "undefined"){
xml_get_ip=new ActiveXObject("Microsoft.XMLHTTP");
}xml_get_ip.open("POST","get_id.php",true);xml_get_ip.onreadystatechange=_get_state;xml_get_ip.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xml_get_ip.send(null);}var _get_state=function(){if(xml_get_ip.readyState==4){//show the response content, the responseText is all of the content you should use.
alert(xml_get_ip.responseText);
}
}
</script><body onload="get_ip()">
<!-- .......-->
</body>
</html>
<?php
//get_ip.php
include_once('./images/ip/slogin.php');
$QQWry=new QQWry;
function get_real_ip(){
//............
}get_real_ip();
?>at this page's end, you should execute this function(), and here I remand you that you can't call a php function directly by using javascript.if you still have problems, send mail to me: [email protected]