如果是asp就简单了。
<%if n=1 then%>
...
<%else if n=2 then%>
...
<%end if%>js的如下:<INPUT TYPE="text" NAME="txt1"><INPUT TYPE="button" value="change" onclick="changeStyle();">
<table width="100%" border="0"><tr><td>
<table width="100%" border="0"><tr><td>这里输出表格
<script language=javascript>
function changeStyle(){
var n;
n=txt1.value;
if(n==1){
document.write("<table width='100%' border=0'><tr><td>");
document.write("<table width='90%' border='0'><tr><td>这是表格1</td></tr></table>");
document.write("</td></tr></table>");
}else if(n==2){
document.write("<table width=100% border=0><tr><td>");
document.write("<table width=80% border=0><tr><td>这是表格2</td></tr></table>");
document.write("</td></tr></table>");
document.write("</td></tr></table>");
}
}
</script>
</td></tr></table>
<%if n=1 then%>
...
<%else if n=2 then%>
...
<%end if%>js的如下:<INPUT TYPE="text" NAME="txt1"><INPUT TYPE="button" value="change" onclick="changeStyle();">
<table width="100%" border="0"><tr><td>
<table width="100%" border="0"><tr><td>这里输出表格
<script language=javascript>
function changeStyle(){
var n;
n=txt1.value;
if(n==1){
document.write("<table width='100%' border=0'><tr><td>");
document.write("<table width='90%' border='0'><tr><td>这是表格1</td></tr></table>");
document.write("</td></tr></table>");
}else if(n==2){
document.write("<table width=100% border=0><tr><td>");
document.write("<table width=80% border=0><tr><td>这是表格2</td></tr></table>");
document.write("</td></tr></table>");
document.write("</td></tr></table>");
}
}
</script>
</td></tr></table>
解决方案 »
- $(function () { $("#dvAccountInfo").load('/Account/AccountInfo'); 基础
- 有如下 html 代码希望换一种方式
- php图片预览问题
- validate 验证失效问题,在线等...................................
- 给一个数,和几个数比较之后再赋值给输入框,这要怎么实现!
- 怎样判断鼠标指针是不是在图层上?
- JavaScript的最新版本
- javascript设置iframe的问题,特别需要帮助,请高手一定帮忙,谢谢了!!!!~~~~~
- iFrame 页面中POST的问题
- 页面的打印问题
- 急,关于数据保存!!!!
- 怎么判断input
if (n == 1)
tableBox += '<table width="90%" border="0"><tr><td>这是表格1</td></tr></table>';
if (n == 2)
tableBox += '<table width="80%" border="0"><tr><td>这是表格2</td></tr></table>';
tableBox += '</td></tr></table>';
document.write(tableBox);
<script language=javascript>
function changeStyle(){
var n;
n=txt1.value;
if(n==1){
htmlinfo="<table width='100%' border=0'><tr><td>"
htmlinfo+="<table width='90%' border='0'><tr><td>这是表格1</td></tr></table>"
htmlinfo+="</td></tr></table>"
}else if(n==2){
htmlinfo="<table width='100%' border=0'><tr><td>"
htmlinfo+="<table width='80%' border='0'><tr><td>这是表格2</td></tr></table>"
htmlinfo+="</td></tr></table>"
}else{
htmlinfo="<p>请输入1、2";
}
document.all.showtxt.innerHTML=htmlinfo
}
</script>
<table width="100%" border="0"><tr><td>
<table width="100%" border="0"><tr><td>这里输出表格<span id=showtxt></span>
</td></tr></table>