如何把javascript的返回值提交到数据库?急!急!在线等!!

来源:百度知道 编辑:UC知道 时间:2024/05/24 23:02:27
<script language="javascript">
function winopen()
{
var result=window.showModalDialog("fac1.asp",window,"scroll:no;resizable:no;help:no;status:no;dialogWidth:400px;dialogHeight:170px");
alert(result);
document.images['x'].src="face/"+result+".gif"

}
</script>
</head>

<body>

<form>

<p><img src="face/11.gif" width="20" height="20" id="x"><a href="javascript:winopen();">请选择头像</a>
<label></label>
</p>
</form>
</body>
我在学着做个留言板,我从子窗口中返回到值怎么提交到数据库中去啊 ,那位给我指点一下 3Q!!!!!!

在页面的表单里增加一个name为imgurl的hidden元素:
<inpit type="hidden" name="imgurl" />

function winopen()
{
var result=window.showModalDialog("fac1.asp",window,"scroll:no;resizable:no;help:no;status:no;dialogWidth:400px;dialogHeight:170px");
alert(result);
document.images['x'].src="face/"+result+".gif"
//在这里纪录选择的图片路径
document.getDocumentById("imgurl").value=="face/"+result+".gif" ;

}

//提交表单后就可以在服务器端获取imgurl的值即你要的.