<script language="vbscript">
function urlencoding(vstrin)
dim i,strreturn
strreturn = ""
for i = 1 to len(vstrin)
thischr = mid(vstrin,i,1)
if abs(asc(thischr)) < &hff then
strreturn = strreturn & thischr
else
innercode = asc(thischr)
if innercode < 0 then
innercode = innercode + &h10000
end if
hight8 = (innercode and &hff00)\ &hff
low8 = innercode and &hff
strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)
end if
next
urlencoding = strreturn
end function
</script>
<script language=javascript>
function O9(id) {window.alert("profile.cgi?action=show&member="+urlencoding(id));}
O9("中文")
</script>
function urlencoding(vstrin)
dim i,strreturn
strreturn = ""
for i = 1 to len(vstrin)
thischr = mid(vstrin,i,1)
if abs(asc(thischr)) < &hff then
strreturn = strreturn & thischr
else
innercode = asc(thischr)
if innercode < 0 then
innercode = innercode + &h10000
end if
hight8 = (innercode and &hff00)\ &hff
low8 = innercode and &hff
strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)
end if
next
urlencoding = strreturn
end function
</script>
<script language=javascript>
function O9(id) {window.alert("profile.cgi?action=show&member="+urlencoding(id));}
O9("中文")
</script>
解决方案 »
- script 中写的php代码为什么报错???
- 请问Ext.ux.grid.GridSummary如何实现全部统计呢?
- 使用三维控件时滚动条的问题
- 粘贴及删除返回上一输入框在Firefox下无效
- 新增table行时,通过document.getElementsByName()取得的标签对象和实际标签name不一致。
- 删除确认的实现,使用在<a>标签上,有javascript
- 一段动态添加表单程序的Javascript代码
- 如何换行?把日期和星期变成二行显示
- div焦点判断
- 各大虾,有没有办法让window.showModalDialog打开的页面关闭的时候,不刷新父页。
- 关于检测 组件 是否已安装?
- 循环,为什么不对???
function O9(id) {window.open("profile.cgi?action=show&member="+escape(id));}
O9("中文")
</script>
转换的格式不对,我用escape(id)转换“中文”两个字
代码为:%u5C0F%u9EA6
而我需要的是:%D6%D0%CE%C4
上面vbscript出来的正确!但我只能用javascript!
不知道有没有办法,谢谢!
<script language=javascript>
function O9(id) {window.alert("profile.cgi?action=show&member="+UrlEncode(id));}
window.onload=new Function('O9("中文Abc")');
</script>