Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-14 03:23:17

raspberryheaven
Member
From: Washington state USA
Registered: 2006-05-21
Posts: 52
Website

javascript a no no in txp?

I have a little javascript snippet I use when I display my email on my website. It looks like this:
<code>
<script>
<!—
var username = “myname”;
var hostname = “gmail.com”;
var linktext = “raspberryheaven”;
document.write(“<a href=” + “mail” + “to:” + username +
“@” + hostname + “>” + linktext + “</a>”)
//—>
</script>
</code>
I recently tried previewing and article i wrote using this method and nothing happens. If I configure my email this way, the page ends up blank where the email is supposed to be.

why would this be? It’s worked before for me on non txp stuff.

Last edited by raspberryheaven (2006-09-14 04:39:36)


“Words have no wings but they can fly a thousand miles.” (Korean Proverb)

Offline

#2 2006-09-14 04:41:43

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: javascript a no no in txp?

Your question is answered in the FAQ.


Alex

Offline

#3 2006-09-14 05:02:52

raspberryheaven
Member
From: Washington state USA
Registered: 2006-05-21
Posts: 52
Website

Re: javascript a no no in txp?

Thanks for the link, however, it left me with another question. If I decide to put

<code><txp:output_form form=“my_js_code” /></code> into a form and call it to the article….then what do I use to call the form?


“Words have no wings but they can fly a thousand miles.” (Korean Proverb)

Offline

#4 2006-09-14 05:25:45

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: javascript a no no in txp?

Other way ;). Put your Javascript into a form called my_js_code, then in your article, call the form using <txp:output_form form="my_js_code" />.

form: my_js_code

<pre>
&lt;script type=&quot;text/javascript&quot;&gt; var username = &quot;myname&quot;; var hostname = &quot;gmail.com&quot;; var linktext = &quot;raspberryheaven&quot;; document.write(&quot;&lt;a href=&quot; + &quot;mail&quot; + &quot;to:&quot; + username + &quot;@&quot; + hostname + &quot;&gt;&quot; + linktext + &quot;&lt;/a&gt;&quot;)
&lt;/script&gt;
</pre>

Article

<pre>
Blah blah blah. Email me at &lt;txp:output_form form=“my_js_code” /&gt;.
</pre>

Offline

#5 2006-09-14 06:02:11

raspberryheaven
Member
From: Washington state USA
Registered: 2006-05-21
Posts: 52
Website

Re: javascript a no no in txp?

oh! woops. I didn’t realize I had it backwards. Thanks. your explanation makes a lot of sense. will repost when I get it done on my site.


“Words have no wings but they can fly a thousand miles.” (Korean Proverb)

Offline

#6 2006-09-14 06:16:44

raspberryheaven
Member
From: Washington state USA
Registered: 2006-05-21
Posts: 52
Website

Re: javascript a no no in txp?

oh, is it ok to save the my_js form as misc?


“Words have no wings but they can fly a thousand miles.” (Korean Proverb)

Offline

#7 2006-09-14 07:22:54

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: javascript a no no in txp?

raspberryheaven wrote:

oh, is it ok to save the my_js form as misc?

sure

Offline

Board footer

Powered by FluxBB