WRATHofGOD18
Programmer
Trying to get a random <title> generator going.
Here is what I have:
<title>Title change</title>
<script language="JavaScript">
mytitle=new Array()
mytitle[0]="New Title One"
mytitle[1]="New Title Two"
mytitle[2]="New Title Three"
mytitle[3]="blah"
len=mytitle.length
randnm=Math.round(Math.random()*(len-1))
document.title=mytitle[randnm]
</script>
</head>
<body>
This is a test
</body>
</html>
My question is- can I call a different file (say titles.php) that has all of the titles in it- instead of putting all of the titles in the index.php and having them availible in the source for everyone to see them all?
I have been trying this:
<?PHP
include("/scripts/titles.php"
;
?>
..code
<script language="JavaScript">
len=mytitle.length
randnm=Math.round(Math.random()*(len-1))
document.title=titles.mytitle[randnm]
</script>
with titles.php having this in it:
<script language="JavaScript">
mytitle=new Array()
mytitle[0]="New Title One"
mytitle[1]="New Title Two"
mytitle[2]="New Title Three"
mytitle[3]="blah"
</script>
Am I going about this wrong?
Thanks
Jesse
Here is what I have:
<title>Title change</title>
<script language="JavaScript">
mytitle=new Array()
mytitle[0]="New Title One"
mytitle[1]="New Title Two"
mytitle[2]="New Title Three"
mytitle[3]="blah"
len=mytitle.length
randnm=Math.round(Math.random()*(len-1))
document.title=mytitle[randnm]
</script>
</head>
<body>
This is a test
</body>
</html>
My question is- can I call a different file (say titles.php) that has all of the titles in it- instead of putting all of the titles in the index.php and having them availible in the source for everyone to see them all?
I have been trying this:
<?PHP
include("/scripts/titles.php"
?>
..code
<script language="JavaScript">
len=mytitle.length
randnm=Math.round(Math.random()*(len-1))
document.title=titles.mytitle[randnm]
</script>
with titles.php having this in it:
<script language="JavaScript">
mytitle=new Array()
mytitle[0]="New Title One"
mytitle[1]="New Title Two"
mytitle[2]="New Title Three"
mytitle[3]="blah"
</script>
Am I going about this wrong?
Thanks
Jesse