怎样实现JS弹出层(带输入框,可后台获取输入内容)?
(2012-10-28 15:43:14)
标签:
弹出层输入框后台获取
it
想要实现的是弹出层有确定和取消两个按钮,一个输入框,点确定之后后台可获取输入框内容,如果是将输入框内容动态赋值到hidden的也可以,这个我会弄,但就是弹出层怎么都弄不好,不知道应该怎样来解决?
可以如下面的代码这样来试试,以post方式提交的话,给文本框加个name直接submit,在后台根据name获取值,如下面的详细代码:
/p>
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
xmlns="http://www.w3.org/1999/xhtml">
无标题文档function add(){
var div=document_createElement_x("div");
div.style.position="absolute";
div.style.left="0px";
div.style.top="0px";
div.style.width="1400px";
div.style.height="600px";
div.style.backgroundColor="black";
div.style.filter="alpha(opacity=40)";
div.style.opacity=.4;
div.setAttribute("id","div");
var div2=document_createElement_x("div");
var input1=document_createElement_x("input");
input1.type="text";
input1.value="input";
input1.setAttribute("id","test");
div2.a(input1);
var input2=document_createElement_x("input");
input2.type="button";
input2.value="提交";
input2.οnclick=subs;
div2.a(input2);
var input3=document_createElement_x("input");
input3.type="button";
input3.value="取消";
input3.οnclick=cancel;
div2.a(input3);
var c=document_createElement_x("center");
c.a(div2);
div.a(c);
document.body.a(div);
}
function subs(){
var a=document.getElementByIdx_x("test").value;
window.location.href="http://www.baidu.com/s?wd="+a;
}
function cancel(){
var p=document.getElementByIdx_x("div");
document.body.removeChild(p);
}
value="add">
分享:
喜欢
0
赠金笔
加载中,请稍候......
评论加载中,请稍候...
发评论
登录名: 密码: 找回密码 注册记住登录状态
昵 称:
评论并转载此博文
发评论
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。