问题如下:
我传了个XML文件给客户端,让其在IE里运行一个小程序来解析XML,这个我做了,我已经拿到了XML文件里的数据,然后要显示在页面上,但是有格式要求,字体要72号绿色,如何解决。<script type="text/javascript"> function test() {………………var str="hellokitty";………………//从XML中拿到数据,都是汉字,utf-8编码
a=strNodes[1].getAttribute("a");
b=strNodes[2].getAttribute("b");
c=strNodes[3].getAttribute("c");………………
str=a+b+c
renturn str;
}
window.onload=function()
{
document.getElementsByTagName("p")[0].innerText=text();
}
</script>
</head><body>
<p></p></body>
现在就是在页面显示的a b c等汉字要让其字体变大 颜色变掉 格式也要变掉,主要是上下三行的结构。
还有XML文件是要刷新的
数据变掉但是样式不变在线求高手解决
我传了个XML文件给客户端,让其在IE里运行一个小程序来解析XML,这个我做了,我已经拿到了XML文件里的数据,然后要显示在页面上,但是有格式要求,字体要72号绿色,如何解决。<script type="text/javascript"> function test() {………………var str="hellokitty";………………//从XML中拿到数据,都是汉字,utf-8编码
a=strNodes[1].getAttribute("a");
b=strNodes[2].getAttribute("b");
c=strNodes[3].getAttribute("c");………………
str=a+b+c
renturn str;
}
window.onload=function()
{
document.getElementsByTagName("p")[0].innerText=text();
}
</script>
</head><body>
<p></p></body>
现在就是在页面显示的a b c等汉字要让其字体变大 颜色变掉 格式也要变掉,主要是上下三行的结构。
还有XML文件是要刷新的
数据变掉但是样式不变在线求高手解决
参考以下思路:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script type="text/javascript">
//html 字符串拼写:字体样式 也可以拼img
var str1= "<span style='font-size:72px; color:#0C3'>"+ a +"</span>";
var str2= "<span style='font-size:72px; color:#0C3'>"+ b +"</span>";
var str3= "<span style='font-size:72px; color:#0C3'>"+ c +"</span>";
str = str1 + str2 + str3;//最后将拼好的html代码插入指定位置
document.getElementById("ShowHere").innerHTML = str;
</script>
</head>
<body>
<div id="ShowHere"></div>
</body>
</html>
比如:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script type="text/javascript">
var a = "南京";
var b = "杭州";
var c = "上海";
//页面加载完毕执行函数
function DoShowInfo()
{
//html 字符串拼写:字体样式 也可以拼img
var str1= "<span style='font-size:72px; color:#0C3'>"+ a +"</span>";
var str2= "<span style='font-size:72px; color:#0C3'>"+ b +"</span>";
var str3= "<span style='font-size:72px; color:#0C3'>"+ c +"</span>";
str = str1 + str2 + str3
//最后将拼好的html代码插入指定位置
document.getElementById("ShowHere").innerHTML = str;
}
</script>
</head>
<body onload="DoShowInfo()">
<div id="ShowHere"></div>
</body>
</html>