栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

PHP与jQuery的超级组合

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

PHP与jQuery的超级组合

1.jquery.js 此处下载: http://code.google.com/p/jqueryjs/
2.目录结构:
html目录中存放html.html文件
inc目录中存放 jQuery.php文件
js目录中存放jQuery.js文件
主目录下存放html.php文件
3.内容:
html.html文件:


<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>PHP+jQuery组合测试title><style>h5{color:#CC3333;margin:0px;padding:0px;}#test{    font:bold 14px;    color:#003366;    cursor:pointer;}style>head><body><h5>PHP+jQuery超级组合实验2:会话与参数传递h5><hr/><div id="user">div><form method="post" action="html.php" id="form1" name="form1"><label for="name"><input id="name" name="name" maxlength="20"/><br/><label for="age"><input id="age" name="age" maxlength="3"/><br/><input type="submit" name="submit" value="提交"/>form><h5>PHP+jQuery超级组合实验1:简单测试h5><hr/><div id="test">Hello World! Click me please!div><id="pinfo">hello.p>body>html>

jQuery.php


    function jQinit($html){            if($html != NULL && $html != "")            {                    $html=file_get_contents($html);                    echo $html;                 }                 $jqstr=file_get_contents("js/jQuery.js");             echo "";     }     //参数$jstr:jQuery脚本字符串;$html模板页面路径.function jQuery($jstr){//jQuery脚本$jQuery=<<?>

html.php


//引用jQuery模块require("inc/jQuery.php");//初始化本页对应的htmljQinit("html/html.html");?>{1}
  POST["name"] != "" && class="php" name="code">{1}
  POST["age"] != ""){ $name=class="php" name="code">{1}
  POST["name"]; $age=class="php" name="code">{1}
  POST["age"]; class="php" name="code">{1}
  SESSION["name"] = $nameclass="php" name="code">{1}
  SESSION["age"] = $age;}if(class="php" name="code">{1}
  SESSION["name"] != "" && class="php" name="code">{1}
  SESSION["age"] != ""){$jq=<<"#user").text("您的名字:{php" name="code">{1}
  SESSION['name']} 年龄:{class="php" name="code">{1}
  SESSION['age']}");EOT;//调用jQueryjQuery($jq);}?>确实不错!";$jQuery=<<测试成功!"); $("#test").click(function(){ alert("拉登,您好."); }); $("#pinfo").text("今天天气不错啊!{$info}");EOT;//调用jQueryjQuery($jQuery);?>  
  

 

  

效果预览:
  "http://hi.csdn.net/attachment/201108/9/0_1312867256CjnL.gif" alt="">

?>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/228949.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号