工作2-3年的朋友们,javascript掌握到什么程度了?

minheen 2009-01-22 01:43:43
想问问。。还有ajax
...全文
752 68 打赏 收藏 转发到动态 举报
写回复
用AI写文章
68 条回复
切换为时间正序
请发表友善的回复…
发表回复
gzdiablo 2009-02-04
  • 打赏
  • 举报
回复


System.UI.tabPage = function()
{
this.classType = "System.UI.tabPage";
Class.initialize.apply(this,arguments);
}
System.UI.tabPage.prototype = {
initialize:function(_parent,o)
{
this.parent = _parent;
this.selected = false;
this.options = {
title:"New TAB",
width:80,
closeAble:false
};
Object.extend(this.options,o);
System.UI.elementInit.apply(this);
},
initElement:function()
{
this.field = $C("DIV");
this.tabObj = $C("li");
this.closeButton = this.tabObj.appendChild($C("div"));
this.bgRight = this.tabObj.appendChild($C("A"));
this.bgLeft = this.bgRight.appendChild($C("DIV"));
this.bgCenter = this.bgLeft.appendChild($C("DIV"));
this.titleObj = this.bgCenter.appendChild($C("span"));
this.parent.tabsField.appendChild(this.tabObj);
this.parent.pageField.appendChild(this.field);
},
scrollToView:function(){this.parent.scrollTo(this);},
setElement:function()
{
var css = System.UI.tabControl.css;
this.bgRight.href="javascript:;";
this.tabObj.className = css.TAB;
this.bgRight.className = css.TAB_BACKGROUND_RIGHT;
this.bgLeft.className = css.TAB_BACKGROUND_LEFT;
this.bgCenter.className = css.TAB_BACKGROUND;
this.closeButton.className = css.TAB_CLOSEBUTTON;
this.titleObj.className = css.TAB_TITLE;
this.field.className = css.TAB_PAGE;
this.field.style.display = "none";
this.title(this.options.title);
this.width(this.options.width);
this.closeAble(this.options.closeAble);
},
initEvent:function()
{
var self = this;
this.closeButton.onclick = function(){self.parent.removeTab(self);Browser.Event.cancelBubble(true);}
this.tabObj.onclick = function(){self.select();}
},
killEvent:function()
{
this.closeButton.onclick = this.bgRight.onclick = this.tabObj.onclick = null;
},
title:function(value)
{
if(typeof(value)=="string")
{
this.titleObj.textContent = this.titleObj.innerText =
this.options.title = value;
this.fireEvent("ontitlechange",value);
}
return this.options.title;
},
width:function(value)
{
if(value!=null)
{
value = parseInt(parseNum(value));
this.bgCenter.style.width = this.options.width = value?(value+"px"):"auto";
}
return this.options.width;
},
select:function(){this.parent.tabChange(this);},
focus:function()
{
this.selected = true;
this.scrollToView();
this.tabObj.className = System.UI.tabControl.css.TAB_SELECTED;
this.display(true);
this.fireEvent("onfocus");
},
blur:function()
{
this.selected = false;
this.tabObj.className = System.UI.tabControl.css.TAB;
this.display(false);
this.fireEvent("onblur");
},
display:function(value)
{
if(value!=null)
{
this._display = !!value;
this.field.style.display = this._display?"block":"none";
}
return this._display;
},
unload:function()
{
this.parent.tabs.Remove(this);
this.tabObj.parentNode.removeChild(this.tabObj);
this.field.parentNode.removeChild(this.field);
System.killInstance(this);
this.killEvent();
for(o in this)delete this[o];
},
closeAble:function(value)
{
if(value!=null)
{
this.options.closeAble = value = !!value;
this.bgLeft.style.paddingRight = value?"19px":"";
this.closeButton.style.display = value?"":"none";
}
return this.options.closeAble;
}
}
gzdiablo 2009-02-04
  • 打赏
  • 举报
回复
放个一年前的代码:自己的运行库Runtime.js就不放了

System.StyleSheets.add("css/tabControl.css");
System.Scripts.add(System.Scripts.paths + "UIBase.js");
if(System==null)var System={};
if(System.UI==null)System.UI={};

System.UI.tabControl = function(){
this.classType = "System.UI.tabControl";
Class.initialize.apply(this,arguments);
}
System.UI.tabControl.css = {
TAB_CONTROL:"tabcontrol",
TAB_PANEL:"tab-panel",
TAB_HEAD:"tab-header",
TAB_SCROLL:"tab-scroll",
TAB_BUTTON:"tab-tab",
SCROLL_LEFT:"tab-sl",
SCROLL_RIGHT:"tab-sr",
TAB:"tab-tab",
TAB_SELECTED:"tab-tab1",
TAB_BACKGROUND:"tab-bg",
TAB_BACKGROUND_LEFT:"tab-bl",
TAB_BACKGROUND_RIGHT:"tab-br",
TAB_TITLE:"tab-bt",
TAB_PAGEFIELD:"tab-pagefield",
TAB_PAGE:"tab-page",
TAB_CLOSEBUTTON:"tab-bc"
}

System.UI.tabControl.prototype = {
initialize:function(_container,o)
{
this.container = _container;
this.tabs = [];
this.selectedTab = null;
this.options = Object.extend({
allowClose:false,
width:600,
height:400,
scrollSpeedLevel:3
},o)
if(this.container==null)return;
System.UI.elementInit.apply(this);
},
initElement:function()
{
this.mainObj = $C("DIV");
this.panel = $C("div");
this.header = $C("DIV");
this.tabsField = $C("ul");
this.pageField = $C("div");
this.leftButton = $C("div");
this.rightButton = $C("div");
with(this.mainObj)
{
appendChild(this.panel);
appendChild(this.pageField);
}
with(this.panel)
{
appendChild(this.leftButton);
appendChild(this.rightButton);
appendChild(this.header);
}
this.header.appendChild(this.tabsField);
this.container.appendChild(this.mainObj);
},
setElement:function()
{
var css = System.UI.tabControl.css;
this.pageField.className = css.TAB_PAGEFIELD;
this.panel.className = css.TAB_PANEL;
this.mainObj.className = css.TAB_CONTROL;
this.header.className = css.TAB_HEAD;
this.tabsField.className = css.TAB_SCROLL;
this.leftButton.className = css.SCROLL_LEFT;
this.rightButton.className = css.SCROLL_RIGHT;
this.width(this.options.width);
this.height(this.options.height);
this.resetScrollBar();
},
initEvent:function()
{
var self = this;
this.leftButton.onclick = function(){self.scrollLeft();}
this.rightButton.onclick = function(){self.scrollRight();}
this.panel.onselectstart = function(){return false;}
},
killEvent:function()
{
this.panel.onselectstart = this.leftButton.onclick = this.rightButton.onclick = null;
},
scrollLeft:function(step)
{
step = parseInt(parseNum(step)) || 1;
step--;
var leftlimit = this.header.scrollLeft;
var arr = [];
for(var i=this.tabs.length-1;i>=0;i--)
{
if(this.tabs[i].tabObj.offsetLeft<leftlimit)
arr[arr.length] = this.tabs[i];
}
step = step<arr.length?step:(arr.length-1);
this.scrollTo(arr[step]);
},
scrollRight:function(step)
{
step = parseInt(parseNum(step)) || 1;
step--;
var rightlimit = this.header.scrollLeft + this.header.clientWidth;
var arr = [];
for(var i=0,l=this.tabs.length;i<l;i++)
if(this.tabs[i].tabObj.offsetLeft + this.tabs[i].tabObj.offsetWidth > rightlimit)
arr[arr.length] = this.tabs[i];
step = step<arr.length?step:(arr.length-1);
this.scrollTo(arr[step]);
},
scrollTo:function(obj)
{
if(obj && obj.classType=="System.UI.tabPage")
{
obj = obj.tabObj;
if(obj.offsetLeft < this.header.scrollLeft)
this.scroll(obj.offsetLeft - 3);
else if(obj.offsetLeft + obj.offsetWidth > this.header.scrollLeft + this.header.clientWidth)
this.scroll(obj.offsetLeft + obj.offsetWidth - this.header.clientWidth + 3)
}
},
scroll:function(limit)
{
var self = this;
var direct = this.header.scrollLeft<limit?1:-1;
var ts;
var move = function(){
var left = self.header.scrollLeft + ((Math.abs(self.header.scrollLeft-limit)>>self.options.scrollSpeedLevel)*direct || direct);
if((left-limit)*direct<=0)
{
self.header.scrollLeft = left;
ts = setTimeout(move,10);
}
else
{
self.header.scrollLeft = limit;
self.fireEvent("onscroll");
}
}
move();
},
unload:function()
{
this.mainObj.parentNode.removeChild(this.mainObj);
System.killInstance(this);
this.killEvent();
for(var o in this)delete this[o];
},
addTab:function(o)
{
var os = {closeAble:this.options.allowClose}
var ss = this.tabs[this.tabs.length] = new System.UI.tabPage(this,Object.extend(os,o));
this.resetHeader();
if(this.selectedTab==null && this.tabs.length>0)this.tabs[0].select();
this.resetScrollBar();
this.fireEvent("onaddtab",ss);
return ss;
},
removeTab:function(o)
{
switch(typeof(o))
{
case "number":
o = this.tabs[parseInt(o)];
case "object":
var index = this.tabs.indexOf(o)
if(o && index>-1)
{
o.fireEvent("onclose");
this.fireEvent("onremovetab",o);
o.unload();
if(index>0)index--;
if(this.selectedTab==o)this.selectedTab = null;
if(this.selectedTab==null && this.tabs.length>0)this.tabs[index].select();
this.resetScrollBar();
}
break;
}
},
resetHeader:function()
{
var height = this.tabsField.firstChild?this.tabsField.firstChild.offsetHeight:2;
this.leftButton.style.height = this.rightButton.style.height = (height+1) + "px";
this.tabsField.style.height = height + "px";
},
resetScrollBar:function()
{
var last = this.tabs[this.tabs.length-1];
if(last && last.tabObj.offsetLeft + last.tabObj.offsetWidth > this.header.clientWidth)
{
this.leftButton.style.display = this.rightButton.style.display = "block";
this.header.style.marginLeft = this.header.style.marginRight = "";
}
else
{
this.header.scrollLeft = 0;
this.leftButton.style.display = this.rightButton.style.display = "none";
this.header.style.marginLeft = this.header.style.marginRight = "0px";
}
this.resetWidth();
},
tabChange:function(tab)
{
if(this.selectedTab!=tab)
{
if(this.selectedTab)this.selectedTab.blur();
tab.focus();
this.fireEvent("onchange",{oldTab:this.selectedTab,newTab:tab});
this.selectedTab = tab;
tab.fireEvent("onselected");
}
},
resetWidth:function()
{
this.panel.style.width = this.pageField.style.width = this.options.width + "px";
this.header.style.width = (this.options.width - this.leftButton.offsetWidth - this.rightButton.offsetWidth) + "px";
},
width:function(value)
{
if(value!=null)
{
value = parseInt(parseNum(value));
this.options.width = value<140?140:value;
this.resetWidth();
this.fireEvent("onresize");
}
return this.options.width;
},
height:function(value)
{
if(value!=null)
{
value = parseInt(parseNum(value));
this.options.height = value<60?60:value;
value = value - this.panel.offsetHeight;
this.pageField.style.height = value + "px";
this.fireEvent("onresize");
}
return this.options.height;
},
allowClose:function(value)
{
if(value!=null)
{
this.options.allowClose = value = !!value;
for(var i=0,l=this.tabs.length;i<l;i++)
this.tabs[i].closeAble(value);
}
return this.options.allowClose;
}
}

fengjian_428 2009-02-01
  • 打赏
  • 举报
回复
JS会了AJAX也就会了
LikeCode 2009-02-01
  • 打赏
  • 举报
回复
那要看这人没有有关注JS了,工作了N年,对JS,CSS还是很生疏的WEB程序员大有人在。
其实JS跟普通的开发语言一样的,只要系统的看一遍教程,写JS代码就很简单多了,半懂不懂的,寸步难行。
zhulei2008 2009-02-01
  • 打赏
  • 举报
回复
jquery
prototype
javascript
都用过点点
lianglei9810 2009-02-01
  • 打赏
  • 举报
回复
(function(t){alert(t);return function(s){alert(t+s)}})("cs")(" t+s");
变异 已经自行了解了
lianglei9810 2009-02-01
  • 打赏
  • 举报
回复
(function(){var a="1234";return (function(t){alert(t+a);})("hello")})();
匿名方法 不是很懂 但是我能改 。。。
wanghui0380 2009-01-31
  • 打赏
  • 举报
回复
就像我现在的公司,我们初期的web项目,任然还是用传统的table,td,tr构建,只有原型通过了,功能上没啥改变了,我们才会交给界面设计部门,让他们去做web2.0的优化css,div,js是他们的事情,我们不管。(很奇怪的事情,按道理界面交互功能应该一早就应该出来滴,实际不是,做界面滴通常不理会写代码滴,所以你他们一早就来给界面定型是件头痛滴事情,他们完全不会整理功能和设计交互,反到是我们这些程序员更会交互设计)
talen_lu 2009-01-31
  • 打赏
  • 举报
回复
能解决问题,
多做系统架构与分析.
wanghui0380 2009-01-31
  • 打赏
  • 举报
回复
对于非界面工程师来说通常并不需要了解太多js。
实际上对于我所知道的传统程序员来说,基本上这些东西只限了解,会用,并不要求精通,因为他基本不算程序的核心,他是一种锦上添花的东西,而不是雪中送炭滴东西。
呵呵,并没有多少公司要求非要用js完成,用js多数是在项目后期美化和完善用户体验,但是核心功能绝不在js和,就算现在用js用的比较多的google,如果核心功能都没完成,那么他的js又从那里出呢??google talk,goolge map,gmail如果没有完善的后台核心,你认为他的js又是如何写出来滴
liujiajia_ 2009-01-31
  • 打赏
  • 举报
回复
我也只会alert;o(∩_∩)o...哈哈[Quote=引用 5 楼 fangq 的回复:]
我只会alert
[/Quote]
a21999 2009-01-31
  • 打赏
  • 举报
回复
完全不会
wangzhenyue 2009-01-31
  • 打赏
  • 举报
回复
俺就会
alert..
document.getElementById
这2个。。惭愧啊
刀枪blue 2009-01-26
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 hongqi162 的回复:]
引用 5 楼 fangq 的回复:
我只会alert


me too
[/Quote]
greatverve 2009-01-26
  • 打赏
  • 举报
回复
js是可以研究得很深的,但是我现在是够用为准。
我只研究怎样实现功能,不研究复杂的理论上的东西,
用jQuery已经实现了我需要的所有功能。
liaopindan 2009-01-25
  • 打赏
  • 举报
回复
只会用一些简单的javaScript
m_gray 2009-01-25
  • 打赏
  • 举报
回复
((function(){
var a="1234";
return function(t){
alert(t+a);
}
})())("hello");

闭包么. 51js上面 研究希奇古怪写法的人可是不少.这两年出的几本新书里 貌似都有这些个介绍了.
as12a 2009-01-25
  • 打赏
  • 举报
回复
c/s能做到什么地步,我在b/s能做到什么地步,当然我接触asp.net比较久了
ZJ159 2009-01-25
  • 打赏
  • 举报
回复
我还不会啊 嘿嘿
fanliang11 2009-01-25
  • 打赏
  • 举报
回复
javascript 掌握一般,改改fckeditor,是没问题了。能把JavaScript做到面向对象,你的水平就到瓶颈了,就差思想了。

// Method: loadToolbarSet()
// Description: Loads a toobar buttons set from an array inside the Toolbar holder.
// Author: FredCK
// Editor:fanliang11
function loadToolbarSet()
{
var sToolBarSet = URLParams["Toolbar"] == null ? "Default" : URLParams["Toolbar"] ;
var sCanUpload= ( URLParams['Upload'] == 'true' );//Editor:fanliang11
// FredCK: Toobar holder (DIV)
var oToolbarHolder = document.getElementById("divToolbar") ;
var oToolbar = new TBToolbar() ;
oToolbar.LoadButtonsSet( sToolBarSet ) ;
if(!sCanUpload)
{
var attachId= IndexArray(oToolbar.Bands.Array[1].Items.Array, "upload",0);//Editor:fanliang11
RemoveArray(oToolbar.Bands.Array[1].Items.Array,attachId);//Editor:fanliang11
}
oToolbarHolder.innerHTML = oToolbar.GetHTML() ;
}

//Method:Index
//Description:Add The name of Method is "Index" for Array Method
//Author:fanliang11
function IndexArray(arrayitem,item, i){ //判断Array的原型是否已作indexOf方法的扩展
i || (i = 0); //初始化起步查询的下标,比较奇特的写法。
var length = arrayitem.length;
if (i < 0) i = length + i; // 如i为负数,则从数组末端开始。
for (; i < length; i++)
if (arrayitem[i].Name === item) return i; // 使用全等于(===)判断符
return -1;
};

//Method:remove
////Description: Add The name of Method is "remove" for Array Method.
//Author:fanliang11
function RemoveArray(array,attachId)
{
for(var i=0,n=0;i<array.length;i++)
{
if(array[i]!=attachId)
{
array[n++]=array[i]
}
}
array.length -= 1;
}
加载更多回复(48)

62,266

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧