首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(0) | 引用(0) | 阅读2133次
PHP MYSQL 通用数据处理 JAVASCRIPT 传值 调用 HTML

<html> www.shengfang.org
<HEAD>
<title>例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 <SCRIPT LANGUAGE="JavaScript"> www.shengfang.org
function sfsf() www.shengfang.org
{
 var  khstr="sdf"               //先将php变量转变成javascript变量khstr。
 alert(khstr); www.shengfang.org
}
function  qwer2()
{    www.shengfang.org
 var companyname=new Array();var companyid=new Array();companyname[0]='123';companyid[0]='12';companyname[1]='9999';companyid[1]='0';companyname[2]='77734';companyid[2]='14';companyname[3]='23222';companyid[3]='5';companyname[4]='432342';companyid[4]='6';companyname[5]='1231234';companyid[5]='7';companyname[6]='433333';companyid[6]='8';companyname[7]='12434';companyid[7]='11';companyname[8]='1111';companyid[8]='15';companyname[9]='768678';companyid[9]='13';companyname[10]='1234';companyid[10]='16';companyname[11]='234';companyid[11]='17';companyname[12]='sfsf';companyid[12]='18'; with  (document) 
 {    www.shengfang.org
  
  for(i=all("mmenu").options.length;i>=0;i--)
  {  
   all("mmenu").options.remove(i);  //需要清除原有的项目 
   } 
  for(i=0;i<companyname.length;i++)
  {  
   var obj1=new Option(companyname[i],companyid[i]);
   all("mmenu").options.add(obj1); 
   
   } 
  } 
}   www.shengfang.org
function  qwer(pSelect)
{    www.shengfang.org
 expireDate = new Date ;
 //document.cookie="userName='"+pSelect+"'; expires="+expireDate.toGMTString() ;
 delCookie("TestCookie");
 delCookie("usersfsf");
 alert(document.cookie);
 setCookie("usersfsf",pSelect);
 alert(document.cookie);
 idd='5';sql='select departmentname,departmentid  from departments  where companyid =  5';var y=new Array(); alert(sql);
 alert(idd);
 with  (document) 
 {  
  for(i=all("smenu").options.length;i>=0;i--)
  {  
   all("smenu").options.remove(i);  //需要清除原有的项目 
   } 
  for(i=0;i<y.length;i++)
  {  
   obj=document.createElement("option"); 
   obj.text=y[i]; 
   all("smenu").options.add(obj); 
   
   } 
  } 

</script> www.shengfang.org
<select name="mmenu" onChange="qwer(this[this.selectedIndex].value)">

</select> 
<SCRIPT LANGUAGE="JavaScript">
function setCookie(name,value)
{
 var Days = 30;
 var exp = new Date(); //new Date("December 31, 9998");
 exp.setTime(exp.getTime() + Days*24*60*60*1000);
 document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)
{
 thisCookie=document.cookie.split("; ");
 for (i=0; i<thisCookie.length;i++)
 {
  temp=thisCookie[i].split("=");
  //alert(temp); www.shengfang.org
  if(temp[0]==name)
   return temp[1]; www.shengfang.org
  else
   return null;
  //alert("', and the value is '"+thisCookie[i].split("=")[1]+"'<BR>");  
  }
 //var arr,reg=new RegExp("(^ | )"+name+"=([^;]*)(; |$)");
 /*var arr,reg=new RegExp("(^ | )"+name+"=([^;]*)(; |$)");
 alert(reg);
 if(arr=document.cookie.match(name))
  return unescape(arr[2]);
 else
  return null; */
}
function delCookie(name)
{   www.shengfang.org
 var exp = new Date();
 exp.setTime(exp.getTime() - 1);
 var cval=getCookie(name);
 if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

qwer2();
</script>
<select  name="smenu">  //子菜单设计 
</select> 
<input name='sf' >
</html>
www.shengfang.org
虽然列表框变化的时候调用了 ONCHANGE QWER 函数,QWER函数也进入了PHP函数,也弹出了对话框提示了SQL语句之类的,但是永远都是以前的上一次的USERSFSF所保存的COOKIE数值,所以没有办法进行动态调用。失败告终。


字体:

Permanant URI永久地址 http://www.shengfang.org/blog/p/lampTYDATAjsphphtml.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1130716464

2005年10月31日07:54星期一  [Dev开发] 追踪此文的RSS
提示:
此文还没有评论。

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告
Fire and Motion!

统计信息
[Yippee]||[统计]||日志:1790
在线: 9||用户: 2563 [列表]
今日:488||到访:2682127
Rss:841902||评论:1585

最新日志

最新评论

友情链接

日历

最新引用

搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8