2013-12-20 20 views
-11

我正在製作一個網站,但我只想顯示一條通知(只有當成員打開網站時)。此通知必須顯示在html主頁上方(因爲主頁可能會因成員而改變)。我想使用'不透明'在主頁上方製作一個淡入淡出的頁面(以便成員也可以在通知的四面看到主頁),我不能使用「提醒」,因爲通知包含圖片,代碼和一些額外的功能的代碼,如前面的顏色。到目前爲止,我發現'不透明'使用上面的圖像,但我怎麼能在我的網站的html主頁上面使用'不透明'?我想在我的網站的html主頁上使用'不透明'。我可以使用它嗎?

<html> 
<head> 
<style> 
div.bacgro 
    { 
    width:500px; 
    height:250px; 
    background:url of a jpg file; 
    border:2px solid black; 
    } 
div.trabox 
    { 
    width:400px; 
    height:180px; 
    margin:30px 50px; 
    background-color:#ffffff; 
    border:1px solid black; 
    opacity:0.6; 
    filter:alpha(opacity=60); /* For IE8 and earlier */ 
    } 
div.trabox p 
    { 
    margin:30px 40px; 
    font-weight:bold; 
    color:#000000; 
    } 
</style> 
</head> 

<body> 

<div class="bacgro"> 
<div class="trabox"> 
<p>This is some text that is placed in the transparent box. It may contain some code and small profile image also ... 
</p> 
</div> 
</div> 

</body> 
</html> 

,但最重要的是我想替換background:url of a jpg file;background:"url of my site's homepage";

+3

的一部分,你有什麼已經嘗試過? – BenM

回答

0

我不太清楚你問什麼,但如果你想要一個警告或小的消息,你有幾種選擇。

警告框

<script> 
function myFunction() 
{ 
alert("I am an alert box!"); 
} 
</script> 

或者你可以試試這個

<script language="javascript" type="text/javascript"> 
<!-- 
function popitup(url) { 
newwindow=window.open(url,'name','height=200,width=150'); 
if (window.focus) {newwindow.focus()} 
return false; 
} 

// --> 
</script> 

這是兩個常見的方式做一個彈出消息。

0

如果您的通知只是一個形象,在你的CSS,你可以這樣做:

.yourNoticeId 
{ 
    opacity:0.4; /* scale 0-1 */ 
    filter:alpha(opacity=40); /* For IE8 and earlier */ 
} 

如果它是一個div

.yourdiv 
{ 
    /*r = red color g = green color b = blue color and a = opacity 0-1 scale */ 
    background: rgba(200, 54, 54, 0.5); 
} 
+0

@ [Super_user_two](http://stackoverflow.com/users/2255175/super-user-two)它是一個3層頁面,第一層或頂層包含通知,第二層或中間層包含淡入淡出頁面和第三層圖層或最後一層包含我網站的主頁(帶有實時動態)---可以嗎? – Worldofgoutam

相關問題