花垣县高中招生:懂javascript语言的请进

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 20:18:44
function mouseRightButtonDisabled()
{
if ((event.button==2) || (event.button==3))
{
alert("惑前惑技汲疙 公窜档侩规瘤甫 困窍咯\n\n付快胶 坷弗率 滚瓢篮 荤侩窍角 荐 绝嚼聪促.");
return false;
}
}

document.onmousedown = mouseRightButtonDisabled;

//魄概磊 促吝 僳拳锅龋 扑诀
function goTelNoPage(sDealerCustNo)
{
window.open("http://www.gmarket.co.kr/challenge/neo_goods/telno_popup.asp?sellcustno=" + sDealerCustNo, "MoreTelno", "width=401, height=401, scrollbars=no, toolbar=no , status=no");
}

解释一下以上代码,越全面越好。谢谢!!

大家让让.高手来了
function mouseRightButtonDisabled()
{
if ((event.button==2) || (event.button==3))
{
alert("惑前惑技汲疙 公窜档侩规瘤甫 困窍咯\n\n付快胶 坷弗率 滚瓢篮 荤侩窍角 荐 绝嚼聪促.");
return false;
}
}
定义了一个函数,它的功能是屏蔽鼠标的右键和中间的滑动滚轮,使使用着点右键即中间滑动滚轮的时候,弹出对话框从而达到屏蔽的目的

event.button==2代表屏蔽的右键event.button==3代表屏蔽了中间的滑动滚轮
document.onmousedown = mouseRightButtonDisabled意思是当按下鼠标的时候调用该函数,

function goTelNoPage(sDealerCustNo)
{
window.open("http://www.gmarket.co.kr/challenge/neo_goods/telno_popup.asp?sellcustno=" + sDealerCustNo, "MoreTelno", "width=401, height=401, scrollbars=no, toolbar=no , status=no");
}
是定义了另外的一个函数,当调用该函数的时候打开一个宽度为401.高度为401.没有滚动条.没有工具栏.没有状态栏的网页

js得replace确实只替换第一个找到得要替换得,后面不管。
给你一个函数:
function replaceAll(text,replacement,target){
if(text==null || text=="") return text;//如果text无内容,返回text
if(replacement==null || replacement=="") return text;//如果replacement无内容,返回text
if(target==null) target="";//如果target无内容,设置为空串
var returnString="";//定义返回值变量,并初始化
var index=text.indexOf(replacement);//定义查找replacement的索引下标,并进行第一次查找
while(index!=-1)
{//直至未找到replacement,要么进行下面的处理
alert(index);
alert(returnString);
returnString+=text.substring(0,index)+target;//如果找到的replacement前有字符,累加到返回值中,并加上target
text=text.substring(index+replacement.length);//取掉找到的replacement及前边的字符
index=text.indexOf(replacement);//进行查询,准备下一次处理
}
if(text!="") returnString+=text;//如果找到的最后一个replacement后有字符,累加到返回值中
return returnString;//返回
}
比如你上面得代码为:
replaceAll("afagagat","a","b");