我加载了个静态网页,上面有个显示字符串的地方,我想用程序中的值。怎么在HTML中写脚本啊?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="google-site-verification" content="D1gGstaLYHWPX5dBfhPxTs-9BkMPyY7qZ_5A0k7rnRg" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="expires" content="" />
<meta name="author" content="Shen_ruyan" />
<link href="style/css.css" rel="stylesheet" type="text/css" />
</head>
<script language="JavaScript" type="text/javascript">
function next() {
//var textvalue = document.getElementsByName('sub')[0].value
//var textvalue1 = eval(document.getElementById('num1').value);
var textvalue = (document.getElementById('monetary').value);
//var textvalue1 = (document.getElementById('num2').value);
//var textvalue3 = (document.getElementById('num3').value);
window.ncp.clickOnAndroid_Monetary(textvalue);
}
function point() {
var obj = document.getElementById("num1");
obj.value = "";
obj.style.color = "#000000";
}
function point2() {
var obj = document.getElementById("num2");
obj.value = "";
obj.style.color = "#000000";
}
</script>
<body>
<div id="validation">
<div class="validation_text">您本次消费金额为:monetary元</div>
</div>
</body>
</html>
静态网页的代码,那个monetary是程序中的变量。怎么写JavaScript用来显示那个变量!
如果你是希望这个页面纯静态的形式存在,那么可以多去了解下“无刷新网页技术”。如果是动态页面,如jsp、asp、php、aspx等,你得去了解下相应技术的网页开发技术。