Passing a variable into a text string

Results 1 to 4 of 4

Thread: Passing a variable into a text string

  1. #1
    Gerbil Guest

    Default Passing a variable into a text string

    I am formatting a date from a database and I want the new date to be written in a certain part of my page. I don&#039;t want to have a text box all I want to be able to do is write the new date.<BR><BR>How can I write the variable from the function into my table. I have tried the following but it doesn&#039;t work: -<BR><BR> &#060;td width="76%" bgcolor="#FFFFCC"&#062;&#060;font size="2"&#062;&#060;%= mynewdate %&#062;&#060;/font&#062;&#060;/td&#062;<BR><BR>Any ideas?

  2. #2
    Wild J Guest

    Default RE: Passing a variable into a text string

    You must have a problem in the function post the code for that as well.

  3. #3
    Gerbil Guest

    Default RE: Passing a variable into a text string

    Here is my function, written using javascript<BR><BR>function FormatMydate()<BR> {<BR> var date; <BR> var index = 0<BR> var int = 0<BR> <BR> date = new Array(3);<BR> <BR> date[0] = window.document.formatmydate.myydate.value; <BR> date[1] = window.document.formatmydate.fixeddate.value;<BR> date[2] = window.document.formatmydate.signoff.value;<BR> <BR> alert(window.document.formatmydate.myydate.value); <BR> <BR> for(index; index &#060; 3; index++)<BR> { <BR> var day = "";<BR> var month = "";<BR> var year = "";<BR> var slashcount = 0<BR> var newdate;<BR> <BR> var mynewdate;<BR> var mynewfixeddate;<BR> var mynewsignoff;<BR> <BR> if(date[index]!= "")<BR> {<BR> if(date[index].charAt(0) != 0)<BR> {<BR> month = date[index].charAt(0);<BR> }<BR> if(date[index].charAt(1) != "/")<BR> {<BR> month = month + date[index].charAt(1)<BR> }<BR> else<BR> {<BR> slashcount++;<BR> }<BR> <BR> if(date[index].charAt(2) != "/")<BR> {<BR> day = date[index].charAt(2)<BR> }<BR> else<BR> {<BR> slashcount++;<BR> }<BR> <BR> if(date[index].charAt(3) != "/")<BR> {<BR> day = day + date[index].charAt(3)<BR> }<BR> else<BR> {<BR> slashcount++;<BR> }<BR> <BR> if((date[index].charAt(4) != "/") && slashcount == 1)<BR> {<BR> day = day + date[index].charAt(4)<BR> }<BR> else if((date[index].charAt(4) != "/") && slashcount == 2)<BR> {<BR> year = date[index].charAt(4)<BR> }<BR> else<BR> {<BR> slashcount++;<BR> }<BR> <BR> if(date[index].charAt(5) != "/")<BR> {<BR> year = year + date[index].charAt(5)<BR> }<BR> else<BR> {<BR> slashcount++;<BR> }<BR> <BR> if(date[index].charAt(6) != "/")<BR> {<BR> year = year + date[index].charAt(6)<BR> }<BR> <BR> if(date[index].charAt(7) != "/")<BR> {<BR> year = year + date[index].charAt(7)<BR> }<BR> <BR> newdate = day + "/" + month + "/" + year;<BR><BR> if(index == 0)<BR> {<BR> mynewdate = newdate;<BR> alert(mynewdate);<BR> }<BR> else if(index == 1)<BR> {<BR> mynewfixeddate = newdate;<BR> }<BR> else<BR> {<BR> mynewsignoff = newdate;<BR> }<BR> }<BR> }<BR><BR> <BR> } <BR>

  4. #4
    Gerbil Guest

    Default HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts