[英]Javascript strings not supporting special characters
I have an HTA with 3 frames which overall looks like this: 我有3帧的HTA,总体看起来像这样:
<html>
<head>
<script type="text/javascript">
function f(){
frames["toolbar"].document.write("Toolbar");
frames["statusbar"].document.write("Status bar");
}
</script>
<frameset rows="65,*,19" onload="f()">
<frame src="about:blank" name="toolbar" application="yes"/>
<frame src="url.html" name="main" application="yes"/>
<frame src="about:blank" name="statusbar" application="yes"/>
</frameset>
</html>
Note: The content of the toolbar and statusbar frames are more complicated than what's specified here. 注意:工具栏和状态栏框架的内容比此处指定的更为复杂。
Notice that two frames are defined using JavaScript and don't have a real URL. 请注意,两个框架是使用JavaScript定义的,没有真实的URL。
Since this HTA is in Swedish, i need to use Swedish special letters which are å, ä and ö, for example alert("Du är inte uppkopplad")
. 由于此HTA是瑞典语,因此我需要使用å,ä和ö等瑞典语特殊字母,例如
alert("Du är inte uppkopplad")
。 The problem is that in the toolbar frame and in the statusbar frame which the content has been defined in JavaScript, this alert box looks like this: 问题在于,在已经在JavaScript中定义了内容的工具栏框架和状态栏框架中,此警报框如下所示:
It replaces ä with an ugly square in the toolbar frame and in the statusbar frame, but not in the main frame (which has a real URL). 它在工具栏框架和状态栏框架中用丑陋的正方形代替ä,但是在主框架(具有真实URL)中则用丑陋的正方形代替。 How do I fix this?
我该如何解决?
It works if I create a variable in the parent HTA which takes the value ä
like this: 如果我在父HTA中创建一个变量,它的值
ä
如下所示,它将起作用:
Main HTA: 主要HTA:
<html>
<head>
<script type="text/javascript">
function f(){
frames["toolbar"].document.write("<script type='text/javascript' src='script.js'><\/script>");
frames["statusbar"].document.write("Status bar");
}
var a = "ä"
</script>
<frameset rows="65,*,19" onload="f()">
<frame src="about:blank" name="toolbar" application="yes"/>
<frame src="url.html" name="main" application="yes"/>
<frame src="about:blank" name="statusbar" application="yes"/>
</frameset>
</html>
script.js: 的script.js:
alert("Du " + parent.a + "r inte uppkopplad");
Thanks to t.niese for giving me the idea in a comment. 感谢t.niese在评论中给我提出了这个想法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.