Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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
Offline
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
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>
<script type="text/javascript">
var username = "myname";
var hostname = "gmail.com";
var linktext = "raspberryheaven";
document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + ">" + linktext + "</a>")
</script>
</pre>
Article
<pre>
Blah blah blah. Email me at <txp:output_form form=“my_js_code” />.
</pre>
Offline
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
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
Re: javascript a no no in txp?
raspberryheaven wrote:
oh, is it ok to save the my_js form as misc?
sure
Offline
Pages: 1