CHINH PHỤC
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Đăng nhập

Ghi nhớ
Latest topics
» Tôi sẽ đỗ đại học!
by nightWalker 9/2/2024, 7:00 pm

» Kỷ niệm xưa của chúng ta
by nightWalker 9/2/2024, 6:49 pm

» Bị lệch khung cần người giúp đỡ
by webhuy28 7/10/2021, 10:34 pm

» [HỎI ĐÁP] Danh sách bạn bè không thể hiển thị
by anhdaodaica1 2/10/2021, 10:04 pm

» [HỎI ĐÁP] Thông tin tài khoản không thể lưu thay đổi
by anhdaodaica1 2/10/2021, 6:05 am

» Phim bố già full
by huy.pc52 24/8/2021, 12:20 am

» Xin code Box HTML cho Forumvi
by Larva 1/7/2021, 12:57 pm

» Hello Anh Em Chinh phục
by HoàngTửNaivip5p 28/5/2021, 5:03 am

» Trang chủ tin tức cập nhật HOT 2016
by kenbi05 1/1/2020, 11:02 pm

» Không Dang9 bài viết = hình ảnh được
by huy.pc52 30/11/2019, 10:52 am

» CHÚC ANH EM NĂM MỚI VUI VẺ TRÀNG ĐẦY HẠNH PHÚC
by sps.kủn 12/2/2019, 1:16 pm

» Skin CNTT-K3 2015 (Full Mod)[✔]
by kenbi05 6/7/2018, 12:30 am

» baivong, handsome,....
by sps.kủn 29/6/2018, 1:54 pm

» [SHARE] SKIN ĐHFM.V7 @PUNBB
by tonyhoaivu 2/5/2018, 2:37 pm

» Share Skin Xanh Dương Cùi Bắp
by tonyhoaivu 28/4/2018, 5:57 pm

» Xin Skin http://v1.hotrofm.net/
by tonyhoaivu 28/4/2018, 5:45 pm

» Xin Skin Rao Vặt
by tonyhoaivu 15/4/2018, 12:07 pm

» Làm Sao Để Xóa Khung Này
by tonyhoaivu 14/4/2018, 7:18 pm

» [Lập nhóm]Lập nhóm fm
by vietkanpy 31/3/2018, 11:53 am

» [Help] về server úp ảnh của phutu [✔]
by baivong 17/3/2018, 10:18 pm

» Đừng khóc cho “tôi – Chinh Phục!”…
by AnHung 27/2/2018, 5:33 pm

» [Share] Skin Diendandaihoc.com [ Punbb ] [✔]
by Lu Mờ 13/2/2018, 7:28 pm

» Mời mấy thím vào groups Forumotion Việt Nam.
by dang02315 13/2/2018, 12:40 am

» Có thể làm các kiểu giao diện được không?
by Lu Mờ 9/2/2018, 3:40 pm

» ltns chinhphuc.info
by Shinichi Kudo 27/1/2018, 2:27 am

Top posting users this week
No user


Hiển thị nội dung bất kỳ trong số các nội dung soạn trước

Go down

Hiển thị nội dung bất kỳ trong số các nội dung soạn trước Empty Hiển thị nội dung bất kỳ trong số các nội dung soạn trước

Bài gửi by CPFounder 9/11/2008, 8:04 pm

Hướng dẫn chèn vào 1 trang html của forum.
Chèn đoạn code sau vào sau thẻ
Code:

<head><style type="text/css">

.jsclass body .randomcontent{ /*Do NOT remove! CSS to hide random contents in JS enabled browsers*/
display: none;
}

</style>

<script type="text/javascript">

/***********************************************
* Random Content (from DIVs) script- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

if (document.getElementById)
document.documentElement.className = 'jsclass'; //hide content for DOM capable browsers


var randomcontentdisplay={
   divholders:new Object(),
   masterclass: "randomcontent",

   init:function(){
      if (!document.getElementById)
         return
      var alldivs=document.getElementsByTagName("div")
      var randomcontentsearch=new RegExp(this.masterclass+"\\s+(group\\d+)", "i") //check for CSS class="randomcontent groupX" (x=integer)
      for (var i=0; i<alldivs.length; i++){
         if (randomcontentsearch.test(alldivs[i].className)){
            if (typeof this.divholders[RegExp.$1]=="undefined") //if array to hold this group of divs doesn't exist yet
               this.divholders[RegExp.$1]=new Array() //create array first
               this.divholders[RegExp.$1].push(alldivs[i]) //add this div to the array
         }
      }
   this.showone()
   },

   showone:function(){
      for (group in this.divholders){ //loop thru each array within object
         var chosenOne=Math.floor(Math.random()*this.divholders[group].length) //randomly pick one entry from array
         this.divholders[group][chosenOne].style.display="block" //display content corresponding to the chosen entry
      }
   }
}

</script></head>
CPFounder
CPFounder
CPAdministrator
CPAdministrator

Firefox PunBB
Ngày đăng ký : 09/04/2008
Số bài : 6169
CPP : 3352
Châm ngôn sống : Vì tương lai Chinh phục chúng ta

http://www.chinhphuc.info

Về Đầu Trang Go down

Hiển thị nội dung bất kỳ trong số các nội dung soạn trước Empty Re: Hiển thị nội dung bất kỳ trong số các nội dung soạn trước

Bài gửi by CPFounder 9/11/2008, 8:05 pm

Sau đó chèn vào vị trí muốn hiển thị trong trang html đó đoạn code sau nội dung :

Code:
<h3>Random Content Group 1 (4 pieces of content total):</h3>

<div class="randomcontent group1">

<p style="border:1px dashed gray; background-color:lightyellow; padding: 10px">Group 1 Content 1</p>

</div>

<div class="randomcontent group1">

<p style="border:1px dashed gray; background-color:lightyellow; padding: 10px">Group 1 Content 2</p>

</div>

<div class="randomcontent group1">

<p style="border:1px dashed gray; background-color:lightyellow; padding: 10px">Group 1 Content 3</p>

</div>

<div class="randomcontent group1">

<p style="border:1px dashed gray; background-color:lightyellow; padding: 10px">Group 1 Content 4</p>

</div>




<h3>Random Content Group 2 (2 pieces of content total):</h3>

<div class="randomcontent group2">

<p style="border:1px dashed gray; background-color:#D8EA99; padding: 10px">Group 2 Content 1</p>

</div>

<div class="randomcontent group2">

<p style="border:1px dashed gray; background-color:#D8EA99; padding: 10px">Group 2 Content 2</p>

</div>

<script type="text/javascript">
//Call this following all random contents HTML on the page:
randomcontentdisplay.init()

</script>
CPFounder
CPFounder
CPAdministrator
CPAdministrator

Firefox PunBB
Ngày đăng ký : 09/04/2008
Số bài : 6169
CPP : 3352
Châm ngôn sống : Vì tương lai Chinh phục chúng ta

http://www.chinhphuc.info

Về Đầu Trang Go down

Hiển thị nội dung bất kỳ trong số các nội dung soạn trước Empty Re: Hiển thị nội dung bất kỳ trong số các nội dung soạn trước

Bài gửi by CPFounder 9/11/2008, 8:07 pm

Bạn nào biết code có thể ứng dụng mở rộng cho 2 hay 3 khung random.
demo : Trang Portal của chinhphuc.
CPFounder
CPFounder
CPAdministrator
CPAdministrator

Firefox PunBB
Ngày đăng ký : 09/04/2008
Số bài : 6169
CPP : 3352
Châm ngôn sống : Vì tương lai Chinh phục chúng ta

http://www.chinhphuc.info

Về Đầu Trang Go down

Hiển thị nội dung bất kỳ trong số các nội dung soạn trước Empty Re: Hiển thị nội dung bất kỳ trong số các nội dung soạn trước

Bài gửi by Sponsored content


Sponsored content


Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết