怎么才算JavaScript高手?

JavaScript011

怎么才算JavaScript高手?,第1张

JS高手……这个范围太广了,能在几个领域把JS用到极致就是专家了:

Node.js 可以开发服务器、API,当后端工程师

Hybrid、React Native 可以开发移动应用,当移动端工程师

nw.js、electron、React Desktop 可以开发桌面应用,当桌面应用工程师

Canvas、OpenGL Unity 可以开发游戏,当游戏开发工程师

Sketch、FramerJS 可以搞设计、搞原型,当交互设计师

Ruff 可以搞嵌入式开发,做嵌入式开发工程师

Cylon、Nodebots、Robotjs 可以做硬件开发,做硬件工程师

…………

只有你想不到,没有做不到,JS的生态是它最大的优势,要说自己是JS高手,那还远得很呢。

js加载iframe框架 弹出框

<、script language="JavaScript" type="text/JavaScript">

function showIframe(url,w,h){

//添加iframe

var if_w = w

var if_h = h

//allowTransparency='true' 设置背景透明

$(" + if_w + "' height='" + if_h + "' id='YuFrame1' name='YuFrame1' style='position:absolutez-index:4' frameborder='no' marginheight='0' marginwidth='0' allowTransparency='true'>").prependTo('body')

var st=document.documentElement.scrollTop|| document.body.scrollTop//滚动条距顶部的距离

var sl=document.documentElement.scrollLeft|| document.body.scrollLeft//滚动条距左边的距离

var ch=document.documentElement.clientHeight//屏幕的高度

var cw=document.documentElement.clientWidth//屏幕的宽度

var objH=$("#YuFrame1").height()//浮动对象的高度

var objW=$("#YuFrame1").width()//浮动对象的宽度

var objT=Number(st)+(Number(ch)-Number(objH))/2

var objL=Number(sl)+(Number(cw)-Number(objW))/2

$("#YuFrame1").css('left',objL)

$("#YuFrame1").css('top',objT)

$("#YuFrame1").attr("src", url)

//添加背景遮罩

$("").prependTo('body')

var bgWidth = Math.max($("body").width(),cw)

var bgHeight = Math.max($("body").height(),ch)

$("#YuFrame1Bg").css({width:bgWidth,height:bgHeight})

//点击背景遮罩移除iframe和背景

$("#YuFrame1Bg").click(function() {

$("#YuFrame1").remove()

$("#YuFrame1Bg").remove()

})

}

<、input type="button" onClick="showIframe('http://baidu.com',460,280)" value="加载"/>

selectTag(showContent,self)

是一个函数,showContent和self是他的两个参数。

<a href="#" onClick="selectTag('tagContent1',this)" href="#">地图位置</a>

这个a标签调用了该函数,传入的参数是'tagContent1'和this,'tagContent1'是一个字符串,this是代表a这个标签,是一个dom对象,根据函数中下面这句代码document.getElementById(showContent).style.display = "block"

可知'tagContent1'被作为id查找节点,即可查找到id为'tagContent1'的div了,总而言之showContent和self只是函数的两个参数,你传入什么它就是什么