简述超链接target属性的取值和作用
- _blank:打开一个全新窗口,并且显示内容(就算在iframe也会重新打开一个窗口)
- _parent:在父框架中打开
- _self:在自身的框架中打开
- _top:在顶层打开,不管多少 iframe,都会在顶层打开
CSS3新增伪类有哪些并简要描述
- :root 文档根元素
- :last-child,:only-child 文本最后一个,唯一一个
- nth-child(n),:nth-last-child(n),nth-of-type(n),:nth-last-of-type 第几个/倒数第几个/指定类型的第几个
- :enabled,:disabled 启用/禁用
- :checked:已勾选
- :default 默认
- :target URL 片段标识符指向元素
写一个把字符串大小写切换的方法
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
<script>
function letterSwicth(target){
return target.replace(/[a-zA-Z]/g,(word)=>{
if (word.charCodeAt() >= "a".charCodeAt(0) &&
word.charCodeAt() <= "z".charCodeAt(0)
){
// 代表小写字母
return word.toUpperCase()
}else if (
word.charCodeAt() >= "A".charCodeAt(0) &&
word.charCodeAt() <= "Z".charCodeAt(0)
){
// 代表大写字母
return word.toLowerCase()
}
return word
})
}
console.log(letterSwicth("aaaaBBBBccc3c"))
</script>
</html>
网友评论