I was wondering how I can assign a string from template.html to a javascript variable. I'm using a php code that transforms rss to html. It replaces strings in a template.html in order to display information. I want to assign these replaced strings in javascirpt. Here my codes:
My template.html
<TABLE width="100%">
~~~BeginItemsRecord~~~
<TR>
<TD>
~~~ItemPubShortTime~~~
</TD>
</TR>
<TR>
<TD>
<B>~~~ItemTitle~~~</B>
</TD>
</TR>
<TR>
<TD>
<BR>
</TD>
</TR>
~~~EndItemsRecord~~~
</TABLE>
When I run my program, for example instead of ~~~ItemPubShortTime~~~ you see time like 10.16AM. I want to assign 10.16 AM to a javascript variable in this file.
My script looks like this:
<script language="javascript">
var sglm=new Array();
sglm[0]= 'Hello World';
</script>
I want to put 10.16AM instead of 'Hello World'. I hope it is clear. Thank you.
sglm[0] = '~~~~ItemPubShortTime~~'. If you need a real date, you have to convert the time to a real date first.