Multiple titles in one page??? HELP
#1
Posted 10 April 2009 - 12:36 PM
My son plays Habbo and he was on a site which looked pretty impressive!
The site is habborator.org and everytime you refresh it notice the The title at the top changes.
So for BC it is BleepingComputer.com all the time but with this HTML code or some sort of script you could make it different everytime it is opened.
EG
BleepingComputer
REFRESH
BC --> For all your computing needs
REFRESH
BC --> Most active computing forum on the net...
Thanks and anyone?????
#3
Posted 10 April 2009 - 07:08 PM
$TInt = rand(1, 8);
switch($Tint) {
case 1:
echo "<title>Hello</title>";
break;
....
default:
echo "<title>Have a nice day</title>";
break;
}Now with javascript you can either set a random number, also if I remember correctly you do not need to set this one in the headers of the script, also seeing as Javascript is action script, you could also create a loop that waits for a certain amount of seconds changes the number and switches for the result (not sure what the function for that would be though)...
var TInt = rand(); //or any other method
switch(TInt) {
case 1:
document.title('Hello'); //It might be a different name for the document object to write to the title...
break;
}
This post has been edited by burn1337: 10 April 2009 - 07:09 PM
#4
Posted 11 April 2009 - 01:11 AM
//titles function chooses a random title
function titles(){
var r = Math.floor(Math.random() * 3.0); //generates random number between 0 and 2
var t = "";
//select a title depending on random number
switch(r){
case 0 : t = "Welcome"; break;
case 1 : t = "Goodbye"; break;
case 2 : t = "Hello"; break;
default: t = "Goodnight";
}
document.title = t; //set the title of current page
}
setInterval("titles()",1000); //calls the titles() function every 1000 milliseconds (1 second)
This post has been edited by Romeo29: 11 April 2009 - 01:15 AM
#5
Posted 11 April 2009 - 01:30 AM
(btw people, my scripts where just sample/examples lol)
#6
#7
Posted 11 April 2009 - 05:15 PM
#8
Posted 03 May 2009 - 10:06 AM
Romeo29, on Apr 11 2009, 07:11 AM, said:
//titles function chooses a random title
function titles(){
var r = Math.floor(Math.random() * 3.0); //generates random number between 0 and 2
var t = "";
//select a title depending on random number
switch(r){
case 0 : t = "Welcome"; break;
case 1 : t = "Goodbye"; break;
case 2 : t = "Hello"; break;
default: t = "Goodnight";
}
document.title = t; //set the title of current page
}
setInterval("titles()",1000); //calls the titles() function every 1000 milliseconds (1 second)How do I go about installing that onot my server?
#9
Posted 03 May 2009 - 10:33 AM
Quote
You implement in the code you want to =']
Who is this doin' this synthetic type of alpha beta psychedelic bleepin'? ~Chemical Brothers - Elektrobank
#10
Posted 03 May 2009 - 12:13 PM
#12
Posted 13 May 2009 - 05:38 AM
You see I want multiple titiles, but I wouldnt know howto make this script work, any help?
#13
Posted 13 May 2009 - 10:19 AM
$title1 = "Page title 1";
$title2 = "Page title 2";
$title3 = "Page title 3";
$title4 = "Page title 4";
$title5 = "Page title 5";
$random = rand(0,4);
if($random ==0)
{
$title = $title1;
}
else if ($random == 1)
{
$title = $title2;
}
else if ($random == 2)
{
$title = $title3;
}
else if ($random == 3)
{
$title = $title4;
}
else if ($random == 4)
{
$title = $title5;
}
?>
<html>
<head>
<title> <?php echo $title;?> </title>
</head>
</html>
This post has been edited by TheStalker: 13 May 2009 - 10:21 AM
#14
Posted 14 May 2009 - 05:00 PM
Its alright having the code but I dont know where it should go... Head? footer , body!
Thanks
Jake
#15
Posted 14 May 2009 - 05:07 PM

Help


Back to top











