昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期三, 四月 15, 2009

包含中文的网址转成全英文

其实是个很简单的东西,在网上找了半天,居然没有现成的...

只好自己动手了. 

写成HTA了,跟批处理用法一样,复制,粘贴到记事本,存成HTA格式, 双击运行...

功能,就是把含有中文的网址成转成全英文的,就是用%XX代替中文,明白?

很多多余的代码,只是为了好看那么一点点,有些代码是纯属多余,没用到,懒得删.

<HTA:APPLICATION
<head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">

 <style>

  body { background-color: #eeeeee; background-repeat: repeat-x; background-position: top}
  td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; color: #333333}
  a{color:#FFCC33;text-decoration:none}
  a:hover{text-decoration:underline}

  .frmDefault_Text { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; height: 20px; width: 400px; background-image: url(images/tplMain_r1_c1.jpg); 
  background-repeat: repeat-x; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}

  .frmDefault_Text_Short { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; height: 20px; width: 60px; background-image: url(images/tplMain_r1_c1.jpg); 
  background-repeat: repeat-x; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}

  .frmDefault_TextArea { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; height: 80px; width: 500px; background-image: url(images/tplMain_r1_c1.jpg); 
  background-repeat: repeat-x; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}

  .frmText_Quantity { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; height: 20px; width: 30px; background-image: url(images/tplMain_r1_c1.jpg); 
  background-repeat: repeat-x; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}

  .frmDefault_Button { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: bold; background-color: #FFCC33; border: #000000; border-style: solid;
  border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}.fntHeader_1 { font-weight: bold; }

.celTable_1_Header { font-weight: bold; background-color: #999999; font-size: 8pt}
.celTable_1_Row td { font-size: 8pt}
.celInstall_Position { background-image: url(bap/images/imgInstall_Car_Aerial.gif); background-repeat: no-repeat; background-position: center center}
.celTool_Tip { background-color: #cccccc; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; border: #FFCC33; border-style: solid; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px}
 </style>

</head>
<body>
把中文网址转换成英文,IE中有效.
<br/>
这里输入原网址:
<input type = "text" size = "50" id = "txtUrl" value = "" class = "frmDefault_Text" />
<br/>
<input type = "button" value = "转换" onclick = "convert()" class="frmDefault_Button" />
<input type = "button" value = "清除" onclick = "clearTxt()" class="frmDefault_Button" />
<br/>
以下是转换出来的结果:
<textarea id = "txtAResult" rows = "5" cols = "50" class = "frmDefault_TextArea" />will be here </textarea>
<br/>
<input type = "button" value = "复制到剪贴板" onclick = "url2Clip()" class="frmDefault_Button" />
<br/>
<script>
 function convert(){
  url = "http://www.cjl520.com/免费下载/小曹影楼素材-SWF转VCD%20DVD工具(最好的FLASH转DVD工具).rar"
  if (txtUrl.value != ""){
  url = txtUrl.value;
  }
  url = encodeURI(url);
  url = url.replace("%25","%");
  txtAResult.value = url;
  
 
 }

 function url2Clip(){

  
  window.clipboardData.setData("text",txtAResult.value)
 }

 function clearTxt(){
  
  txtUrl.value = "";
 }
 
 window.onload=ini
 function ini(){
  
  var x=600;y=280
  window.resizeTo(x,y)
  document.title="中文链接转英文"
  txtUrl.focus();
 }

</script>
</body>
</hta>



--
Feng

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.