XF 1.3 How to include functions

ibaker

Well-known member
I have a html page that includes a form and functions that I want to create an entry for in XF Resources. I use the parsehtml addon that enables me to use html in a post to create the form however I don't know how to include the functions for the form other than include them in the XF Resource entry which I presume is not the best thing to do.

Any suggestions...thanks

Oh, here is another one apart from the above which includes a script. I want to add an XF Resource entry that enables users to know their local time and UTC time. Here is the script:
Code:
<script language="JavaScript" type="text/javascript">
<!--
var clockID = 0;
var weekday=new Array(7);
weekday[0]="Sun";
weekday[1]="Mon";
weekday[2]="Tue";
weekday[3]="Wed";
weekday[4]="Thu";
weekday[5]="Fri";
weekday[6]="Sat";

function UpdateClock() {
  if(clockID) {
     clearTimeout(clockID);
     clockID  = 0;
  }

  var tDate = new Date();
//  var tDate = new Date("February 28, 2007 03:15:00");
  var UTCDay = weekday[tDate.getUTCDay()];
  var UTCDate = tDate.getUTCDate();
  var UTChours = tDate.getUTCHours();
  var UTCMins = tDate.getUTCMinutes();
  var UTCSeconds = tDate.getUTCSeconds();
  var stdDay = weekday[tDate.getDay()];
  var stdDate = tDate.getDate();
  var hours = tDate.getHours();
  var minutes = tDate.getMinutes();
  var seconds = tDate.getSeconds();
  document.theClock.theStdTime.value = ""
                                  + pad(hours) + ":"
                                  + pad(minutes) + ":"
                                  + pad(seconds);
  document.theClock.theUTCTime.value = ""
                                  + pad(UTChours) + ":"
                                  + pad(UTCMins) + ":"
                                  + pad(UTCSeconds);
  document.theClock.theStdDate.value = ""
                                  + stdDay
                                  + setDateString(stdDate);
  document.theClock.theUTCDate.value = ""
                                  + UTCDay
                                  + setDateString(UTCDate);

  clockID = setTimeout("UpdateClock()", 1000);
}

function StartClock() {
  clockID = setTimeout("UpdateClock()", 500);
}

function KillClock() {
  if(clockID) {
     clearTimeout(clockID);
     clockID  = 0;
  }
}

function pad(strIn) {
    var strOut = '0' + strIn
    return(String(strOut).substr(String(strOut).length -2))
}

function setDateString(nDate) {
    if (nDate==1||nDate==21||nDate==31) {
        return " " + nDate + "st";
    } else if (nDate==2||nDate==22) {
        return " " + nDate + "nd";
    } else if (nDate==3||nDate==23) {
        return " " + nDate + "rd";
    } else {
        return " " + nDate + "th";
    }
}
//-->
</script>

and here is the html that I want the XF Resource entry to show:
Code:
<body onload="StartClock()" onunload="KillClock()">
    <form name="theClock" action="">
        <b>Current UTC Time</b><br />
        <input type="text" name="theUTCDate" size="11" style="border-style:solid; border-width:1px; font-size: 12pt; color: #006699; text-align: center; font-weight: bold; padding:1px 4px;" />
        <br />
        <input type="text" name="theUTCTime" size="6" style="border-style:solid; border-width:1px; font-size: 18pt; color: #006699; text-align: center; font-weight: bold; padding:1px 4px;" />
        <br /><br />
        <b>Your Local Time</b><br />
        <input type="text" name="theStdDate" size="11" style="border-style:solid; border-width:1px; font-size: 12pt; color: #006699; text-align: center; font-weight: bold; padding:1px 4px;" />
        <br />
        <input type="text" name="theStdTime" size="6" style="border-style:solid; border-width:1px; font-size: 18pt; text-align: center; color: #006699; font-weight: bold; padding:1px 4px;" />
    </form>
</body>

Attached is the full html page that I want to create an XF Resource entry with...thanks for any help
 

Attachments

Top Bottom