后台代码中如何创建iframe啊
我现在想实现这样的功能:通过一个数组,如private string[] WebSiteList ={ "www.163.com ", "www.126.com "};,这里面包含2个网址,然后点击一个button,把这2个网站用2个iframe显示,怎么做啊.
------解决方案--------------------不用后台做吧
前台可以使用javascript做的
方法为
var iframe1=document.createElement( "iframe ");
------解决方案--------------------你要的方法实例我没有,具体方法使用我给你一个我自己写的例子
<!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>
<title> c#属性生成器 </title>
<script type= "text/javascript ">
function change()
{
var tbody=document.getElementById( "tbody ");
while(tbody.hasChildNodes())
{
tbody.removeChild(tbody.lastChild);
}
document.getElementById( "Div1 ").innerHTML= " ";
var select=document.getElementById( "Select1 ");
var j;
var i;
for(i=0;i <select.length;i++)
{
if(select.options[i].selected == true)
{
break;
}
}
for(var j=0;j <i;j++)
{
var tr=document.createElement( "tr ");
var td=document.createElement( "td ");
var text=document.createElement( "input ");
text.setAttribute( "type ", "text ");
text.setAttribute( "id ", "t "+j);
td.appendChild(text);
var td1=document.createElement( "td ");
var s=document.createElement( "select ");
s.setAttribute( "id ", "s "+j);
var option=document.createElement( "option ");
s.appendChild(option);
option.setAttribute( "value ", "string ");
option.setAttribute( "text ", "string ");
var option1=document.createElement( "option ");
s.appendChild(option1);
option1.setAttribute( "value ", "int ");
option1.setAttribute( "text ", "int ");
var option2=document.createElement( "option ");
s.appendChild(option2);
option2.setAttribute( "value ", "double ");
option2.setAttribute( "text ", "double ");
td1.appendChild(s);
var td2=document.createElement( "td ");
td2.appendChild(document.createTextNode( "请选择类型: "));
var td3=document.createElement( "td ");
td3.appendChild(document.createTextNode( "请输入值: "));
tr.appendChild(td2);
tr.appendChild(td1);
tr.appendChild(td3);
tr.appendChild(td);
document.getElementById( "tbody ").appendChild(tr);
}
}
function Button1_onclick()
{
var select=document.getElementById( "Select1 ");
var j;
var i;
for(i=0;i <select.length;i++)
{
if(select.options[i].selected == true)
{
break;
}
}
var se,text;
var sb= " ";
var sb1= " ";
for(var j=0;j <i;j++)
{
se=document.getElementById( "s "+j);
text=document.getElementById( "t "+j);
if(text.value!= " ")
{
var m;
for(m=0;m <se.leng