JS能否对页面中的单独某个String值编码? 用HTML里专用空格写法 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 对不起是我没有说清楚这个空格是显示在option的text里的而option的text不是解析html,而是一个String..所以在GB2312的编码下是没有问题的.. "option的text不是解析html"???----------------------把css拷到源文件中,再浏览看看是不是正常的(顺便注意一下css里的字体有没变成乱码) ^_^js里...var textValue_1 = "test" + " " + ":";var textValue_2 = "tes" + " " + " " + ":";document.all.selectId.options[0].text = textValue_1;document.all.selectId.options[1].text = textValue_2;在GB2312下":"对齐,在UTF-8下不对齐.....不信的朋友可以试一下 <br/><font face="MingLiU">111|||tzzgg</font> <br/><font face="MingLiU">wwwWWWt中国</font><br/><font face="黑体">wwwWWWt中国</font> <br/><font face="隶书">wwwWWWt中国</font> <br/><font face="宋体">wwwWWWt中国</font> <br/><font face="新宋体">wwwWWWt中国</font> <br/><font face="幼圆">wwwWWWt中国</font> -------------以上字体是可以对齐的字体,设置一下试试看 try:var textValue_1 = "test" + " " + ":";var textValue_2 = "tes" + " " + " " + ":";document.all.selectId.options[0].innerHTML = textValue_1;document.all.selectId.options[1].innerHTML = textValue_2; 注意:<select size="1" id="D1" name="D1" style="font-family: Courier New"> 发现FrontPage的一个bug大家把下面的原代码拷贝到FrontPage下试试:<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><META NAME="GENERATOR" Content="Microsoft FrontPage 4.0"><TITLE></TITLE><style>option {font-size:20pt}</style><SCRIPT ID=clientEventHandlersJS LANGUAGE=vbscript><!--sub button1_onclick document.all.D1.options(0).text = "1111" & chr(32) & chr(32) & ":" document.all.D1.options(1).text = "11111" & chr(32) & ":" document.all.D1.options(2).text = "111111:" document.all.D1.options(3).text = "11" & chr(32) & "11" document.all.D1.options(4).text = "11" & chr(32) & "11" end sub//--></SCRIPT></HEAD><BODY><P><INPUT id=button1 type=button value=Button name=button1 onclick="button1_onclick"></P><form name="f1" id="f1"><select size="1" id="D1" name="D1" style="font-family: Courier New"> <option>1111 :</option> <option>11111:</option> <option>aaaaaaaa</option> <option>aaaaaaaa</option> <option>aaaaaaaa</option></select></form>function formatScoreStr(value) { var l = 20; var newValue var index = value.indexOf(":"); if(index > 0){ var tempScore = value.substring(0,index); var tempName = value.substring(index + 1); var scoreLength = tempScore.length; if(scoreLength < l){ var addBlank = l - scoreLength; for(var i =0;i<addBlank;i++){ tempScore = tempScore + " "; } } newValue = tempScore + ":" + tempName; } return newValue;} </BODY></HTML> 怎么做一个表单,有两个提交按钮,并提交到不同的服务器脚本? 写入js文件的 alert 不响应,但是放在HTML响应,这是WHY? 如何处理jsp中用java赋值的js变量 求一个关于百度实现搜索的javascript代码问题(急!) 神门求救啊,帮忙解密这段神秘的JS代码 EXT4 radioGroup.setValue()方法 怎样换行 关于调用客户端的打印程序 checkbox 如何实现不可以多选?只能选择一个,象radio button那样? 相同名字文本框的问题 请教怎么样让光驱通过程序自动弹出和关闭??up有分 关于错误信息提示的问题
是我没有说清楚
这个空格是显示在option的text里的
而option的text不是解析html,而是一个String..所以在GB2312的编码下是没有问题的..
???
----------------------
把css拷到源文件中,
再浏览看看是不是正常的(顺便注意一下css里的字体有没变成乱码)
js里...
var textValue_1 = "test" + " " + ":";
var textValue_2 = "tes" + " " + " " + ":";document.all.selectId.options[0].text = textValue_1;
document.all.selectId.options[1].text = textValue_2;在GB2312下":"对齐,在UTF-8下不对齐.....
不信的朋友可以试一下
<br/><font face="MingLiU">wwwWWWt中国</font>
<br/><font face="黑体">wwwWWWt中国</font>
<br/><font face="隶书">wwwWWWt中国</font>
<br/><font face="宋体">wwwWWWt中国</font>
<br/><font face="新宋体">wwwWWWt中国</font>
<br/><font face="幼圆">wwwWWWt中国</font> -------------
以上字体是可以对齐的字体,设置一下试试看
var textValue_2 = "tes" + " " + " " + ":";document.all.selectId.options[0].innerHTML = textValue_1;
document.all.selectId.options[1].innerHTML = textValue_2;
<select size="1" id="D1" name="D1" style="font-family: Courier New">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<TITLE></TITLE>
<style>
option {font-size:20pt}
</style>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=vbscript>
<!--sub button1_onclick
document.all.D1.options(0).text = "1111" & chr(32) & chr(32) & ":"
document.all.D1.options(1).text = "11111" & chr(32) & ":"
document.all.D1.options(2).text = "111111:"
document.all.D1.options(3).text = "11" & chr(32) & "11"
document.all.D1.options(4).text = "11" & chr(32) & "11"
end sub//-->
</SCRIPT>
</HEAD>
<BODY><P><INPUT id=button1 type=button value=Button name=button1 onclick="button1_onclick"></P>
<form name="f1" id="f1">
<select size="1" id="D1" name="D1" style="font-family: Courier New">
<option>1111 :</option>
<option>11111:</option>
<option>aaaaaaaa</option>
<option>aaaaaaaa</option>
<option>aaaaaaaa</option>
</select>
</form>
function formatScoreStr(value)
{ var l = 20;
var newValue
var index = value.indexOf(":");
if(index > 0){
var tempScore = value.substring(0,index);
var tempName = value.substring(index + 1);
var scoreLength = tempScore.length;
if(scoreLength < l){
var addBlank = l - scoreLength;
for(var i =0;i<addBlank;i++){
tempScore = tempScore + " ";
}
}
newValue = tempScore + ":" + tempName;
}
return newValue;
}
</BODY>
</HTML>