馬化騰:
他是一個(gè)專(zhuān)注的人。
我不盲目創(chuàng )新,微軟、Google做的都是別人做過(guò)的東西,最聰明的方法肯定是學(xué)習最佳案例,然后再超越。
顯然。珊瑚蟲(chóng)作者是缺乏法律意識,沒(méi)有像騰訊一樣在商業(yè)化過(guò)程中及時(shí)、巧妙地洗干凈自己的商業(yè)模式。
騰訊的十年,也就是中國互聯(lián)網(wǎng)發(fā)展的一個(gè)縮影。這十年,中國的互聯(lián)網(wǎng)在苛責中倔強地成長(cháng)著(zhù),值得驕傲的一點(diǎn)是:中國互聯(lián)網(wǎng)雖然在模仿者的陰影里飽受詬病,但仍在中國本土市場(chǎng)上頑強地生長(cháng),并開(kāi)出極為絢麗的花朵。
ckeditor是個(gè)開(kāi)源工具,是基于CSS和javascript的工具。
ckeditor主要作用就是把頁(yè)面中的textarea多行文本區域變成功能強大的富文本編輯器,可以改變輸入文字的格式啦。實(shí)現過(guò)程也很簡(jiǎn)單:
1、將ckeditor的解壓包放入WebRoot目錄下;
2、然后在需要用到ckeditor的頁(yè)面(本例是add_article.jsp)中將ckeditor.js包含進(jìn)本頁(yè)面:
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
3、接下來(lái)執行以下代碼,來(lái)用ckeditor替換textarea:
<script type="text/javascript">
function initEditor(){
CKEDITOR.replace( 'content',
{
width:700
}
);
}
</script>
</head>
<body onLoad="initEditor()">
“CKEDITOR.replace( 'content',”中的content即是下文中的textarea的name:<textarea rows="20" cols="100" name="content" id="content"></textarea>
表示用ckeditor來(lái)替換name為“content”的textarea。但由于這段javascript代碼在textarea定義前寫(xiě)的,所以我們這么調用他:<body onLoad="initEditor()">
表示頁(yè)面全部加載完成后,在調用onload的initEditor()方法。
效果圖:

在很多網(wǎng)站中可以看到點(diǎn)擊某個(gè)按鈕啦區域啦,很使一塊區域出現或者消失。我們現在用javascript代碼來(lái)實(shí)現這一功能:
Main.jsp頁(yè)面的代碼:

Main.jsp中包含了top.jsp、center.jsp(包含了left.jsp,即要顯示或隱藏的頁(yè)面)和down.jsp頁(yè)面,在本例中用到了top.jsp、center.jsp頁(yè)面。
top.jsp頁(yè)面中的重要的部分代碼:

<td width="147" background="images/main_29.gif" onclick="openClose()" style="cursor:pointer;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="24%"> </td>
<td width="43%" height="20" valign="bottom" class="STYLE1">管理菜單</td>
<td width="33%"> </td>
</tr>
</table>
</td>
Center.jsp頁(yè)面的部分重要代碼:

top.jsp的頁(yè)面是

style="cursor:pointer;"的功能是當把鼠標放到“管理菜單”那一片區域時(shí),會(huì )出現一只手的形狀。同時(shí)當點(diǎn)擊管理菜單那一塊時(shí),觸發(fā)了onclick="openClose()",接下來(lái)分析這段javascript代碼:
window.parent.mainFrame.document.getElementById("leftMenu").width = 1;
Window.parent即是top.jsp頁(yè)面的父面main.jsp。
Window.parent.mainFrame即是center.jsp頁(yè)面。

Window.parent.mainFrame.document.getElementById("leftMenu")即是center.jsp中包含的left.jsp頁(yè)面。

當點(diǎn)擊top.jsp中的管理菜單區域時(shí),調用window.parent.mainFrame.document.getElementById("leftMenu").width = 1;將使left.jsp頁(yè)面寬度為1,即隱藏,而再點(diǎn)擊一下,會(huì )再賦值window.parent.mainFrame.document.getElementById("leftMenu").width = 147;即顯示出來(lái)。
聯(lián)系客服