WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1random fact? Empty random fact? Tue Mar 30, 2010 5:50 pm

Joel

Joel
Registered Member
Registered Member
i'll try explaining this. Whats the codes for random stuffs? I want random facts/rules to appear below my forum in a pop up. A small pop up at the bottom right of the window.

EXAMPLE
A person visits my forum, than a pop up will say "Did you know that you have to follow the forum rules or you will get warnings?".

Than after 3-7 seconds, it will be gone.

http://www.advertisehotspot.info/

2random fact? Empty Re: random fact? Wed Mar 31, 2010 4:57 pm

ankillien

ankillien
Administrator
Administrator
Hi Joel!

You want the popup on index page or on all pages?
I'll try to write some Javascript for this.

3random fact? Empty Re: random fact? Wed Mar 31, 2010 5:09 pm

Fred100

Fred100
Registered Member
Registered Member
Wait , maybe he's asking for a code which is just like "Everytime you refresh your page , It changes"

http://www.art-castle.biz/forum.htm

4random fact? Empty Re: random fact? Wed Mar 31, 2010 6:10 pm

Joel

Joel
Registered Member
Registered Member
ankillien wrote:Hi Joel!

You want the popup on index page or on all pages?
I'll try to write some Javascript for this.

index.

http://www.advertisehotspot.info/

5random fact? Empty Re: random fact? Wed Mar 31, 2010 7:05 pm

ankillien

ankillien
Administrator
Administrator
How about this one...
(You can put it on the homepage message)

Code:
<script type="text/javascript" language="JavaScript">
<!--

function randomMsg(){

var myMsg=new Array()
myMsg[1]="Welcome to WebArtz - The Web Design & Coding Forum"
myMsg[2]="Please reda the rules before posting!!!"

var rm=Math.floor(Math.random()*3)

if (rm==0)
rm=1
alert(myMsg[rm])
}

randomMsg()
//-->
</script>

Notice this part...

myMsg[1]="Welcome to WebArtz - The Web Design & Coding Forum"
myMsg[2]="Please reda the rules before posting!!!"

You can add/edit messages there. Just add myMsg[x] there and replace 'x' with the next number (whatever it is) follow by your message.

Hope that helps Very Happy

6random fact? Empty Re: random fact? Thu Apr 01, 2010 1:21 pm

Joel

Joel
Registered Member
Registered Member
nono, not really what i wanted. I want like a pop up at the bottom right that does'nt obstruct anything.

http://www.advertisehotspot.info/

7random fact? Empty Re: random fact? Thu Apr 01, 2010 9:20 pm

ankillien

ankillien
Administrator
Administrator
hmm...

Would this work for you...

Code:
<script type="text/javascript" language="JavaScript">
function hideDiv() {
 var div = document.getElementById("msg")
 div.style.display="none"
 }
hideDiv()
</script>

<div id="msg" style="position:fixed; bottom:10px; right: 10px; border: 1px solid #666; background: #666; color: #333; font-weight: bold; display:;">
<p style="font-size:12px; margin:0px; padding:2px 5px; text-align: right; background: #333; "><a style="color: red;" href="#" onclick="hideDiv()">X</a></p>

<p style="padding:0 10px; margin:5px; color:#FFF; width: 200px;">
Your message goes here...you can put anything here...this is just a place holder...edit this message!
</p>
</div>

8random fact? Empty Re: random fact? Fri Apr 02, 2010 12:56 pm

Joel

Joel
Registered Member
Registered Member
ankillien wrote:hmm...

Would this work for you...

Code:
<script type="text/javascript" language="JavaScript">
function hideDiv() {
 var div = document.getElementById("msg")
 div.style.display="none"
 }
hideDiv()
</script>

<div id="msg" style="position:fixed; bottom:10px; right: 10px; border: 1px solid #666; background: #666; color: #333; font-weight: bold; display:;">
<p style="font-size:12px; margin:0px; padding:2px 5px; text-align: right; background: #333; "><a style="color: red;" href="#" onclick="hideDiv()">X</a></p>

<p style="padding:0 10px; margin:5px; color:#FFF; width: 200px;">
Your message goes here...you can put anything here...this is just a place holder...edit this message!
</p>
</div>

YES! Perfect. But i want alot of random facts. As in every refresh is a new random fact. And can you make it auto dissapear after 3-4 seconds?

http://www.advertisehotspot.info/

9random fact? Empty Re: random fact? Fri Apr 02, 2010 1:54 pm

ankillien

ankillien
Administrator
Administrator
ok, here is the code for auto hide...

<script type="text/javascript" language="JavaScript">
function hideDiv() {
var div = document.getElementById("msg")
div.style.display="none"
}
function hideDivNow() {
setTimeout("hideDiv()", 4000)
}
function closeDiv() {
var div = document.getElementById("msg");
div.style.display="none"
}
hideDivNow()
</script>

<div id="msg" style="position:fixed; bottom:10px; right: 10px; border: 1px solid #666; background: #666; color: #333; font-weight: bold; display:;">
<p style="font-size:12px; margin:0px; padding:2px 5px; text-align: right; background: #333; "><a style="color: red;" href="#" onclick="closeDiv()">X</a></p>

<p style="padding:0 10px; margin:5px; color:#FFF; width: 200px;">
<script language="JavaScript">

function randomFact(){

var myFact = new Array()
myFact[1]="Code title 1"
myFact[2]="Code title 2"


var ry=Math.floor(Math.random()*3)

if (ry==0)
ry=1
document.write(myFact[ry])
}

randomFact()

</script>
</p>
</div>

You need to edit bolded part. To add more facts add a line after that. Like this...
myFact[X]="my fact goes here"

The box will disappear after 4 seconds.

Hope that helps Very Happy

10random fact? Empty Re: random fact? Fri Apr 02, 2010 2:35 pm

Joel

Joel
Registered Member
Registered Member
awesome! The only thing i want now is making the box transparent/translucent. And can you make it dissapear in 2 seconds?

http://www.advertisehotspot.info/

11random fact? Empty Re: random fact? Fri Apr 02, 2010 2:44 pm

ankillien

ankillien
Administrator
Administrator
Opacity added and time for disappearance reduced to 2 seconds.

<script type="text/javascript" language="JavaScript">
function hideDiv() {
var div = document.getElementById("msg")
div.style.display="none"
}
function hideDivNow() {
setTimeout("hideDiv()", 2000)
}
function closeDiv() {
var div = document.getElementById("msg");
div.style.display="none"
}
hideDivNow()
</script>

<div id="msg" style="position:fixed; bottom:10px; right: 10px; border: 1px solid #666; background: #666; color: #333; font-weight: bold; opacity : 0.7; filter : alpha(opacity=70); display:;">
<p style="font-size:12px; margin:0px; padding:2px 5px; text-align: right; background: #333; "><a style="color: red;" href="#" onclick="closeDiv()">X</a></p>

<p style="padding:0 10px; margin:5px; color:#FFF; width: 200px;">
<script language="JavaScript">

function randomFact(){

var myFact = new Array()
myFact[1]="Code title 1"
myFact[2]="Code title 2"

var ry=Math.floor(Math.random()*3)

if (ry==0)
ry=1
document.write(myFact[ry])
}

randomFact()

</script>
</p>
</div>

One thing I forgot to mention about the code! Notice the bolded part Math.random()*3. You need to replace the number 3 with the total number of the facts you add after adding one Very Happy

Eg. If you have total 10 facts added, put number 11 there. Like this...
var ry=Math.floor(Math.random()*11)

12random fact? Empty Re: random fact? Fri Apr 02, 2010 2:54 pm

Joel

Joel
Registered Member
Registered Member
okay! thanks alot!

http://www.advertisehotspot.info/

13random fact? Empty Re: random fact? Fri Apr 02, 2010 3:23 pm

Sanket

Sanket
Administrator
Administrator
Solved | Locked

http://www.webartzforum.com

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum