<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Inserting strings directly into text' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Inserting strings directly into text' posted on the 'JavaScript' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 14:24:46 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 14:24:46 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Inserting strings directly into text</title>
      <link>http://www.programmersheaven.com/mb/java-script/116677/116677/inserting-strings-directly-into-text/</link>
      <description>Hey, all.&lt;br /&gt;
&lt;br /&gt;
I'm wondering how to insert a string that depends on a date/event/etc.&lt;br /&gt;
into a sentence. eg:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
:&lt;br /&gt;
la la la, here I go typing again even though I have to go in ?? *** and I still have to have lunch...&lt;br /&gt;
:&lt;br /&gt;
:&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where ?? is an integer number of mins/hours/etc.&lt;br /&gt;
and *** is a string "hours"/"mins"/etc.&lt;br /&gt;
&lt;br /&gt;
Any help would be appreciated.&lt;br /&gt;
&lt;br /&gt;
PS. I could write an applet to do it but for some reason a message akin to:&lt;br /&gt;
"Can only create applets for HTML files"&lt;br /&gt;
comes up.&lt;br /&gt;
&lt;br /&gt;
I'm about to go to sun.com to look for a new compiler etc. etc. but I would like to know how its done in javascript...&lt;br /&gt;
&lt;br /&gt;
____________________________&lt;br /&gt;
&lt;br /&gt;
Forever trust in who we are,&lt;br /&gt;
And nothing else matters.&lt;br /&gt;
-Metallica_&lt;br /&gt;
____________________________&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/116677/116677/inserting-strings-directly-into-text/</guid>
      <pubDate>Fri, 17 May 2002 04:12:42 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>Re: Inserting strings directly into text</title>
      <link>http://www.programmersheaven.com/mb/java-script/116677/116768/re-inserting-strings-directly-into-text/#116768</link>
      <description>: Hey, all.&lt;br /&gt;
: &lt;br /&gt;
: I'm wondering how to insert a string that depends on a date/event/etc.&lt;br /&gt;
: into a sentence. eg:&lt;br /&gt;
: &lt;br /&gt;
: &amp;lt;html&amp;gt;&lt;br /&gt;
: :&lt;br /&gt;
: :&lt;br /&gt;
: la la la, here I go typing again even though I have to go in ?? *** and I still have to have lunch...&lt;br /&gt;
: :&lt;br /&gt;
: :&lt;br /&gt;
: &amp;lt;/html&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
: Where ?? is an integer number of mins/hours/etc.&lt;br /&gt;
: and *** is a string "hours"/"mins"/etc.&lt;br /&gt;
: &lt;br /&gt;
: Any help would be appreciated.&lt;br /&gt;
: &lt;br /&gt;
: PS. I could write an applet to do it but for some reason a message akin to:&lt;br /&gt;
: "Can only create applets for HTML files"&lt;br /&gt;
: comes up.&lt;br /&gt;
: &lt;br /&gt;
: I'm about to go to sun.com to look for a new compiler etc. etc. but I would like to know how its done in javascript...&lt;br /&gt;
: &lt;br /&gt;
Okay, I think this is what you want...&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
&amp;lt;html&amp;gt;
:
:
&amp;lt;script language="JavaScript"&amp;gt;&amp;lt;!--
var aDate = new Date()
var myDate //= your string (***)

if(myDate == "hours"){document.write(aDate.getHours())}
if(myDate == "mins"){document.write(aDate.getMinutes())}
if(myDate == "secs"){document.write(aDate.getSeconds())}
//--&amp;gt;&amp;lt;/script&amp;gt;
:
:
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
That should do it.&lt;br /&gt;
&lt;hr /&gt;&lt;br /&gt;
&lt;span style="color: Blue;"&gt;Visual Basic&lt;/span&gt;&lt;br /&gt;
~&lt;strong&gt;Andy&lt;img src="http://www.programmersheaven.com/images/Community/twink.gif" width="15" height="15" alt="" /&gt;&lt;/strong&gt;~&lt;em&gt;SuperJoe30&lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;/em&gt;~&lt;br /&gt;
My Website:&lt;br /&gt;
&lt;a href="http://www.geocties.com/joesarcade"&gt;http://www.geocties.com/joesarcade&lt;/a&gt; &lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
&lt;span style="color: Red;"&gt;JavaScript&lt;/span&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/116677/116768/re-inserting-strings-directly-into-text/#116768</guid>
      <pubDate>Fri, 17 May 2002 10:51:42 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>Re: Inserting strings directly into text</title>
      <link>http://www.programmersheaven.com/mb/java-script/116677/117086/re-inserting-strings-directly-into-text/#117086</link>
      <description>: Okay, I think this is what you want...&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
: &amp;lt;html&amp;gt;
: :
: :
: &amp;lt;script language="JavaScript"&amp;gt;&amp;lt;!--
: var aDate = new Date()
: var myDate //= your string (***)
: 
: if(myDate == "hours"){document.write(aDate.getHours())}
: if(myDate == "mins"){document.write(aDate.getMinutes())}
: if(myDate == "secs"){document.write(aDate.getSeconds())}
: //--&amp;gt;&amp;lt;/script&amp;gt;
: :
: :
: &amp;lt;/html&amp;gt;
: &lt;/pre&gt;&lt;br /&gt;
: That should do it.&lt;br /&gt;
: &lt;hr /&gt;&lt;br /&gt;
: &lt;span style="color: Blue;"&gt;Visual Basic&lt;/span&gt;&lt;br /&gt;
: ~&lt;strong&gt;Andy&lt;img src="http://www.programmersheaven.com/images/Community/twink.gif" width="15" height="15" alt="" /&gt;&lt;/strong&gt;~&lt;em&gt;SuperJoe30&lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;/em&gt;~&lt;br /&gt;
: My Website:&lt;br /&gt;
: &lt;a href="http://www.geocties.com/joesarcade"&gt;http://www.geocties.com/joesarcade&lt;/a&gt; &lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
: &lt;span style="color: Red;"&gt;JavaScript&lt;/span&gt;&lt;br /&gt;
: &lt;hr /&gt;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
I tried the document.write() but it opened a new window...&lt;br /&gt;
But maybe I added something else in. I'll try your code it looks&lt;br /&gt;
like it will work. I'll get back to this post if there's a problem.&lt;br /&gt;
&lt;br /&gt;
Thanks.&lt;br /&gt;
&lt;br /&gt;
____________________________&lt;br /&gt;
&lt;br /&gt;
Forever trust in who we are,&lt;br /&gt;
And nothing else matters.&lt;br /&gt;
-Metallica_&lt;br /&gt;
____________________________&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/116677/117086/re-inserting-strings-directly-into-text/#117086</guid>
      <pubDate>Mon, 20 May 2002 05:29:58 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>document.write()...</title>
      <link>http://www.programmersheaven.com/mb/java-script/116677/117147/documentwrite/#117147</link>
      <description>: I tried the document.write() but it opened a new window...&lt;br /&gt;
&lt;br /&gt;
If you use document.write() because of an event, it erases your web page and makes a new one.&lt;br /&gt;
&lt;br /&gt;
you have to use it while it's loading.&lt;br /&gt;
&lt;hr /&gt;&lt;br /&gt;
&lt;span style="color: Blue;"&gt;Visual Basic&lt;/span&gt;&lt;br /&gt;
~&lt;strong&gt;Andy&lt;img src="http://www.programmersheaven.com/images/Community/twink.gif" width="15" height="15" alt="" /&gt;&lt;/strong&gt;~&lt;em&gt;SuperJoe30&lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;/em&gt;~&lt;br /&gt;
My Website:&lt;br /&gt;
&lt;a href="http://www.geocties.com/joesarcade"&gt;http://www.geocties.com/joesarcade&lt;/a&gt; &lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
&lt;span style="color: Red;"&gt;JavaScript&lt;/span&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/116677/117147/documentwrite/#117147</guid>
      <pubDate>Mon, 20 May 2002 09:57:52 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>Re: document.write()...</title>
      <link>http://www.programmersheaven.com/mb/java-script/116677/117486/re-documentwrite/#117486</link>
      <description>: If you use document.write() because of an event, it erases your web page and makes a new one.&lt;br /&gt;
: &lt;br /&gt;
: you have to use it while it's loading.&lt;br /&gt;
: &lt;hr /&gt;&lt;br /&gt;
: &lt;span style="color: Blue;"&gt;Visual Basic&lt;/span&gt;&lt;br /&gt;
: ~&lt;strong&gt;Andy&lt;img src="http://www.programmersheaven.com/images/Community/twink.gif" width="15" height="15" alt="" /&gt;&lt;/strong&gt;~&lt;em&gt;SuperJoe30&lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;/em&gt;~&lt;br /&gt;
: My Website:&lt;br /&gt;
: &lt;a href="http://www.geocties.com/joesarcade"&gt;http://www.geocties.com/joesarcade&lt;/a&gt; &lt;img src="http://www.programmersheaven.com/images/Community/frown.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
: &lt;span style="color: Red;"&gt;JavaScript&lt;/span&gt;&lt;br /&gt;
: &lt;hr /&gt;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
Exellent, Thank you.&lt;br /&gt;
____________________________&lt;br /&gt;
&lt;br /&gt;
Forever trust in who we are,&lt;br /&gt;
And nothing else matters.&lt;br /&gt;
-Metallica_&lt;br /&gt;
____________________________&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/116677/117486/re-documentwrite/#117486</guid>
      <pubDate>Wed, 22 May 2002 04:23:26 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>Re: document.write()...</title>
      <link>http://www.programmersheaven.com/mb/java-script/116677/118956/re-documentwrite/#118956</link>
      <description>Checl out the span tag... It will make your life a lot easier...&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------&lt;br /&gt;
I will bend your mind with my spoon...&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/116677/118956/re-documentwrite/#118956</guid>
      <pubDate>Thu, 30 May 2002 07:37:42 -0700</pubDate>
      <category>JavaScript</category>
    </item>
  </channel>
</rss>