button link

13 views
Skip to first unread message

Paul Downey

unread,
Jun 23, 2008, 9:25:43 AM6/23/08
to TiddlyWiki
hey,

is there a macro or TW Javascript function to easily create a button
that's an external link?

Paul
--
http://blog.whatfettle.com

Eric Shulman

unread,
Jun 23, 2008, 9:52:53 AM6/23/08
to TiddlyWiki
> is there a macro or TW Javascript function to easily create a button  
> that's an external link?

You can create a pushbutton that opens a URL using pure HTML syntax.

<html><input type='button' value='label'
onclick='window.open("URL","_blank")'></html>

...and, if you are doing this more than once, you can use:
http://www.TiddlyTools.com/#AliasPlugin
to create an "instant macro", like this:

<<alias URLButton [[<html><input type='button' value='%0'
onclick='window.open("%1","_blank")'></html>]]>>

which allows you to easily write:
<<URLButton "click me!" "http://www.rabbithole.com/">>

enjoy,
-e


FND

unread,
Jun 23, 2008, 9:54:52 AM6/23/08
to Tiddl...@googlegroups.com
> is there a macro or TW Javascript function to easily create a button
> that's an external link?

I assume you know about PrettyLinks:
[[label|url]]
That pretty much renders a special macro obsolete, no?

As for the JavaScripte route:
var place = document.getElementById("mainMenu");
var url = "http://www.google.com";
createTiddlyText(createExternalLink(place, url), url);

HTH.


-- F.

Jonathan Lister

unread,
Jul 1, 2008, 10:13:03 AM7/1/08
to Tiddl...@googlegroups.com
Eric,

That's an interesting concept in itself... It's a bit like macro-writing for people that can do HTML but can't do Javascript.

I'm always happy to see examples of one tier of technological skill open up to a less able tier.


J.
--
http://www.jaybyjayfresh.com
Reply all
Reply to author
Forward
0 new messages