js問題

document.getElementByID("Content").innerHTML=text_enter_url;
<script   language="javascript"   charset="GBK"   src="test.js">      
  </script>把js文件的字符集设为GBK(汉字扩展内码规范),这样可以兼容js中出现的中文

JS中将一串UTF-8代码转换成中文(转)

//JS中将一串UTF-8代码转换成中文

 function revertUTF8(szInput)
 {
    var x,wch,wch1,wch2,uch="",szRet="";
    for (x=0; x<szInput.length; x++)
    {
        if (szInput.charAt(x)=="%")
        {
            wch =parseInt(szInput.charAt(++x) + szInput.charAt(++x),16);
            if (!wch) {break;}
            if (!(wch & 0x80))
            {
                wch = wch;
            }
            else if (!(wch & 0x20))
            {
                x++;
                wch1 = parseInt(szInput.charAt(++x) + szInput.charAt(++x),16);
                wch  = (wch & 0x1F)<< 6;
                wch1 = wch1 & 0x3F;
                wch  = wch + wch1;
            }
            else
            {
                x++;
                wch1 = parseInt(szInput.charAt(++x) + szInput.charAt(++x),16);
                x++;
                wch2 = parseInt(szInput.charAt(++x) + szInput.charAt(++x),16);
                wch  = (wch & 0x0F)<< 12;
                wch1 = (wch1 & 0x3F)<< 6;
                wch2 = (wch2 & 0x3F);
                wch  = wch + wch1 + wch2;
            }
            szRet += String.fromCharCode(wch);
        }
        else
        {
            szRet += szInput.charAt(x);
        }
    }
    return(szRet);
}


使用:

<script>document.write(revertUTF8("&#22312;&#23458;&#25142;&#31471;&#36914;&#34892;&#39511;&#35388;"))</script>

http://cwh.boke-cn.com/user2/jacksee/archives/2006/120400.html


关于JS控制treeView的问题
客户端javascript  
  function   onTreeNodeClick(tvw)  
  {  
        tvw.getTreeNode(tvw.clickedNodeIndex).setAttribute('EXPANDED','true');  
  }  
   
  在服务器端添回  
  TreeView1.attributes.add('onclick','onTreeNodeClick(this)');

 

tvw.getTreeNode(tvw.clickedNodeIndex).setAttribute('EXPANDED','true');  
   
  其中tvw是树对象

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值