2 u014688252 u014688252 于 2014.04.13 12:33 提问

asp.net页面有一个div,点击按钮弹出div,需要根据不同条件给div上控件赋值

前台代码:

function showDiv(type) {
switch (type)
{
case 0://新建
$("#btnDelete").hide();
var myDate = new Date();
$("#tbEndTime").val(myDate.getFullYear() + '-' + myDate.getMonth() + '-' + myDate.getDate());
$("#tbStartTime").val(myDate.getFullYear() + '-' + myDate.getMonth() + '-' + myDate.getDate());
break;
default://赋值
//alert("修改");

break;
}
document.getElementById('popDiv').style.display = 'block';
document.getElementById('bg').style.display = 'block';
}

后台 代码:

t.Attributes.Add("onclick", "showDiv('"+t.ID+"')");t为后台生成的table,给table添加单

击事件,单击是修改事件

同时它还有双击事件,双击是新建事件,

t.Attributes.Add("ondblclick", "showDiv(0)");

弹出的是一个div,但是div上控件赋值不相同,修改时需要从数据库查出数据赋值到控件,新建时只需要赋初始值,怎样区分是新建还是修改呢?想通过一种判断来决定调用后台的不同方法。

有谁 有思路?
http://kan.weibo.com/con/3698542959605550?_from=title
http://kan.weibo.com/con/3698542972188471?_from=title
http://kan.weibo.com/con/3698542984771388?_from=title
http://kan.weibo.com/con/3698542997354306?_from=title
http://kan.weibo.com/con/3698543009937225?_from=title
http://kan.weibo.com/con/3698543022640744?_from=title
http://kan.weibo.com/con/3698543030908756?_from=title
http://kan.weibo.com/con/3698543039297369?_from=title
http://kan.weibo.com/con/3698544251451760?_from=title
http://kan.weibo.com/con/3698544264034676?_from=title
http://kan.weibo.com/con/3698544272423288?_from=title
http://kan.weibo.com/con/3698544280932501?_from=title
http://kan.weibo.com/con/3698544289200514?_from=title
http://kan.weibo.com/con/3698544306098338?_from=title
http://kan.weibo.com/con/3698544322754963?_from=title
http://kan.weibo.com/con/3698544331143576?_from=title
http://kan.weibo.com/con/3698545073535719?_from=title
http://kan.weibo.com/con/3698545065147105?_from=title
http://kan.weibo.com/con/3698545061073399?_from=title
http://kan.weibo.com/con/3698545052564186?_from=title
http://kan.weibo.com/con/3698545044296174?_from=title
http://kan.weibo.com/con/3698545040101865?_from=title
http://kan.weibo.com/con/3698545031592652?_from=title
http://kan.weibo.com/con/3698545023324640?_from=title
http://kan.weibo.com/con/3698545828631343?_from=title
http://kan.weibo.com/con/3698545820242732?_from=title
http://kan.weibo.com/con/3698545807659818?_from=title
http://kan.weibo.com/con/3698545794956299?_from=title
http://kan.weibo.com/con/3698545790882594?_from=title
http://kan.weibo.com/con/3698545778179076?_from=title
http://kan.weibo.com/con/3698545782493983?_from=title
http://kan.weibo.com/con/3698545769911066?_from=title
http://kan.weibo.com/con/3698546726212789?_from=title
http://kan.weibo.com/con/3698546738675095?_from=title
http://kan.weibo.com/con/3698546734601400?_from=title
http://kan.weibo.com/con/3698546747184319?_from=title
http://kan.weibo.com/con/3698546751258013?_from=title
http://kan.weibo.com/con/3698546759646623?_from=title
http://kan.weibo.com/con/3698546772229540?_from=title
http://kan.weibo.com/con/3698546789006762?_from=title
http://kan.weibo.com/con/3698548252819446?_from=title
http://kan.weibo.com/con/3698548261208058?_from=title
http://kan.weibo.com/con/3698548269596670?_from=title
http://kan.weibo.com/con/3698548282300209?_from=title
http://kan.weibo.com/con/3698548273911598?_from=title
http://kan.weibo.com/con/3698548298956811?_from=title
http://kan.weibo.com/con/3698548357797713?_from=title
http://kan.weibo.com/con/3698548458340431?_from=title
http://kan.weibo.com/con/3698549930541755?_from=title
http://kan.weibo.com/con/3698549930662376?_from=title
http://kan.weibo.com/con/3698549926347446?_from=title
http://kan.weibo.com/con/3698549863432860?_from=title
http://kan.weibo.com/con/3698549855044247?_from=title
http://kan.weibo.com/con/3698549850970566?_from=title
http://kan.weibo.com/con/3698549842461328?_from=title
http://kan.weibo.com/con/3698549829999036?_from=title
http://kan.weibo.com/con/3698553000894276?_from=title
http://kan.weibo.com/con/3698553009282889?_from=title
http://kan.weibo.com/con/3698553021745200?_from=title
http://kan.weibo.com/con/3698553034328122?_from=title
http://kan.weibo.com/con/3698553042837340?_from=title
http://kan.weibo.com/con/3698553063688262?_from=title
http://kan.weibo.com/con/3698553076391788?_from=title
http://kan.weibo.com/con/3698553093048404?_from=title

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!