...

View Full Version : Is this possible?



toxic27
08-22-2008, 03:09 AM
I have a set of JavaScript countdowns (counting down to different release dates) that I want users to be able to copy and paste a code into there profile (MySpace or whatever) and it will show up. Only problem is that some of the code is in the <HEAD> section and the other half is in the <BODY> section. When I copy both halves and put them together to test them out, it just shows code. Here's the code..


In the <HEAD> section..

<SCRIPT LANGUAGE="JavaScript">
<!--- Hide from non-JavaScript browsers
function LBP(CurrentDay) {
var XYear=CurrentDay.getFullYear();
var XDay=new Date("October, 29, 2008");
XDay.setFullYear(XYear);
var DayCount=(XDay-CurrentDay)/(1000*60*60*2...
DayCount=Math.round(DayCount);
return DayCount;}
function MonthTxt (MonthNumber) {
var Month=new Array();
Month[1]="January";
Month[2]="February";
Month[3]="March";
Month[4]="April";
Month[5]="May";
Month[6]="June";
Month[7]="July";
Month[8]="August";
Month[9]="September";
Month[10]="October";
Month[11]="November";
Month[12]="December";
return Month[MonthNumber]; }
//Stop Hiding --->
</SCRIPT>



In the <BODY> section..

<center><h5 style="position: relative; bottom: -35pt; z-index: 2"><font color="blue">
<script language="JavaScript">
<!---Hide from non-JavaScript Browsers
var Today=new Date();
var ThisDay=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();
var DaysLeft=LBP(Today);
var MonthName=MonthTxt(ThisMonth);
<!-- document.write("Today is "+MonthName+" "+ThisDay+"<br>"); -->
if(DaysLeft > 0) {
document.write(""+DaysLeft+" days until LittleBigPlanet!");
} else {
document.write("LittleBigPlanet is out!");
}
//Stop hiding --->
</script>
</font></h5></center>



How can I make a working embed code so people can copy & paste it into there profile and forum signatures? Thanks!

Philip M
08-22-2008, 08:46 AM
Something wrong here!

var DayCount=(XDay-CurrentDay)/(1000*60*60*2...I think it should it be:-

var DayCount=(XDay-CurrentDay)/(1000*60*60*24);


Just move this block:-

var Today=new Date();
var ThisDay=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();
var DaysLeft=LBP(Today);
var MonthName=MonthTxt(ThisMonth);
<!-- document.write("Today is "+MonthName+" "+ThisDay+"<br>"); -->
if(DaysLeft > 0) {
document.write(""+DaysLeft+" days until LittleBigPlanet!");
} else {
document.write("LittleBigPlanet is out!");
}

to right after:-

<SCRIPT LANGUAGE="JavaScript">
<!--- Hide from non-JavaScript browsers

but the language attribute is deprecated, so change that to

<script type = "text/javascript">

Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose.


The whole aim of practical politics is to keep the populace alarmed (and hence clamorous to be led to safety)
by menacing it with an endless series of hobgoblins, all of them imaginary.
H.L. Mencken 1880-1956, American Editor, Author, Critic, Humorist



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum