// JavaScript Document // page ID: StoryWizard.js // author: Wushitang //Create Date:20110223 //describe: Story Wazard script.. function changTag(Re, ID, reach, tb){ //RE 前缀,字段名 //ID 记录ID //reach 是否用textarea文本框 //tb 更新的表 main:sub var objID = Re + ID; var objJq = $("#"+objID); var obj = objJq.get(0); var oldHTML = objJq.html(); tb = tb=="main"?"main":"sub" with(obj){ if(reach){ innerHTML = "
"; }else{ innerHTML = "
"; } } objJq.parent().find("span.EditButton").hide(); setRows($("#"+objID+"_text").get(0)); } function setValue(objID,txt){ var obj = document.getElementById(objID); $.ajax({ url:"/community/do.asp", data:$("#"+objID+"_form").serialize(), type:"POST", beforeSend:function(){$("#"+objID).find("input[type=submit]").attr({"disabled":"disabled","value":"waiting"})}, dataType:"xml", success:function(msg){ //obj.innerHTML = txt; if($(msg).find('statu').text()=="0"){ obj.innerHTML = $(msg).find("message").text(); $(obj).parent().find("span.EditButton").show(); }else{ $("#"+objID).find("input[type=submit]").attr({"disabled":"","value":"Save"}) alert($(msg).find("message").text()); } } }); return false; } function setRows(obj){ $(obj).height(""); var newH=$(obj).attr("scrollHeight"); if(newH<25){newH=25;} $(obj).height(newH); } function StoryLoading(){ var iWidth = $(document).width(); var iHeight = $(window).height(); var DHeight = $(document).height(); $("body").css({'overflow':'scroll','overflow-y':'hidden'}); $("
Loading....
") .css({'width':iWidth+"px",'height':DHeight+"px"}).children().css('margin-top',(iHeight-30)/2 + "px").end() .appendTo("body"); $(window).scroll(function(){$("#StoryLoading").children().css('margin-top',($(window).height()-30)/2 +$(window).scrollTop()+ "px")}) .resize(function(){$("#StoryLoading").children().css('margin-top',($(window).height()-30)/2 +$(window).scrollTop()+ "px")}); } function stopLoding(){ $("#StoryLoading").remove(); $(window).scroll(function(){}).resize(function(){}); $("body").css({'overflow':'','overflow-y':''}); } function loadingTravelStory(){ $.ajax({ url:"/community/do.asp", data:"ac=loadStory&SN="+$("#coldsn").val(), beforeSend:StoryLoading, type:"POST", dataType:'xml', success:function(msg){ alert($(msg).find('message').text()+$(msg).find('nowid').text()); stopLoding(); if($(msg).find('statu').text()=="0"){ $("input[name=PostOrderId]").click(); //$("#selectGP").submit() } } }) } function storyView(cancel){ //$("#detail").find("span .EditButton").remove(); if(cancel == "r"){ $("#detail,.UPbutton").find("span .EditButton").remove(); $(".UPbutton").remove(); }else if(cancel == "s"){ $("#detail,.UPbutton").find("span .EditButton").show(); $(".UPbutton").show(); }else{ $("#detail,.UPbutton").find("span .EditButton").hide(); $(".UPbutton").hide(); } }