第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

title = this.innerHTML; 這句代碼什么意思????? 為什么刪掉之后整個頁面都沒了呢?? 求指教

<!DOCTYPE HTML>

<html>

<head>

? ? <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

? ? <title>ToolTip效果</title>

? ? <style>

? ? ? ? body {

? ? ? ? ? ? font-size: 18px;

? ? ? ? ? ? line-height: 1.8;

? ? ? ? ? ? font-family: "Microsoft YaHei", "微軟雅黑";

? ? ? ? }


? ? ? ? #demo {

? ? ? ? ? ? width: 500px;

? ? ? ? ? ? margin: 30px auto;

? ? ? ? ? ? padding: 20px 30px;

? ? ? ? ? ? position: relative;

? ? ? ? ? ? background-color: #fff;

? ? ? ? }


? ? ? ? #demo h2 {

? ? ? ? ? ? color: #03F;

? ? ? ? }


? ? ? ? #demo .tooltip {

? ? ? ? ? ? color: #03F;

? ? ? ? ? ? cursor: help;

? ? ? ? }


? ? ? ? /*add box style */

? ? ? ? .box{

? ? ? ? ? ? position:absolute;

? ? ? ? ? ? background-color:#eee;

? ? ? ? ? ? color:#fff;

? ? ? ? ? ? padding:10px;

? ? ? ? ? ? border:#999 solid 1px;

? ? ? ? ? ? border-radius: 5px;

? ? ? ? ? ? box-shadow:2px 2px 4px #ccc;

? ? ? ? ? ? width:300px;

? ? ? ? ? ? height: 200px;

? ? ? ? }

? ? ? ? .box iframe{

? ? ? ? ? ? margin:0px;

? ? ? ? ? ? padding:0px;

? ? ? ? ? ? border:none;

? ? ? ? ? ? background-color: #FFF;

? ? ? ? ? ? width:inherit;

? ? ? ? ? ? height:inherit;

? ? ? ? }

? ? ??

? ? </style>

</head>


<body>

<div id="demo">

? ? <p><a class="tooltip" id="tooltip1">慕課網(wǎng)</a>的使命是傳播互聯(lián)網(wǎng)最前沿技術(shù),幫助更多的人實現(xiàn)夢想!在慕課網(wǎng)前端開發(fā)、

? ? ? ? <a class="tooltip" id="tooltip2">Android</a>開發(fā)、<a class="tooltip" id="tooltip3">iOS</a>開發(fā)等課程統(tǒng)統(tǒng)有,你還在等什么,趕緊來學習吧。

? ? </p>

</div>

<script type="text/javascript">

? ? window.onload=function(){

? ? ? ? //在demo中添加tipbox

? ? ? ? //給tipbox添加over leave event

? ? ? ? var demo = document.getElementById("demo"),

? ? ? ? ? ? tips = demo.getElementsByTagName("a");

? ? ? ? ? ??

? ? ? ? for(var i=0; i<tips.length; i++){

? ? ? ? ? ? tips[i].onmouseenter=function(){

? ? ? ? ? ? ? ? var top = this.offsetTop,

? ? ? ? ? ? ? ? ? ? left = this.offsetLeft,

? ? ? ? ? ? ? ? ? ? title = this.innerHTML;

? ? ? ? ? ? ? ? ? ? box = document.createElement("div");

? ? ? ? ? ? ? ? ? ? box.className = "box";

? ? ? ? ? ? ? ? ? ? box.id = "box";

? ? ? ? ? ? ? ? ? ? box.style.left = left+"px";

? ? ? ? ? ? ? ? ? ? box.style.top = top+20+"px";

? ? ? ? ? ? ? ? ? ? box.innerHTML = "<iframe src='http://baike.baidu.com/search?word="+title+"&enc=utf8'></iframe>";

? ? ? ? ? ? ? ? demo.appendChild(box);

? ? ? ? ? ? ? ? //console.log(top+':'+left);

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? ? ? tips[i].onmouseleave=function(){

? ? ? ? ? ? ? ? demo.removeChild(demo.lastChild);

? ? ? ? ? ? }

? ? ? ? } ? ?

? ? }

</script>

</body>

</html>


正在回答

2 回答

你這里的this是對象本身,也就是mouseenter時的那個a,this.innerHTML 是獲取當前對象的內(nèi)容,如果當前對象內(nèi)部只有文本 ? 那么this.innerHTML 就是文本,如果是標簽組成的內(nèi)容,?那么this.innerHTML 就是標簽組成的內(nèi)容

1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
Tooltip浮動提示框效果
  • 參與學習       25136    人
  • 解答問題       63    個

小效果大作用,提升用戶體驗度,提升編程興趣和水平

進入課程

title = this.innerHTML; 這句代碼什么意思????? 為什么刪掉之后整個頁面都沒了呢?? 求指教

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號