Page 1 of 1

Javascript + Widget = busted OpenURL string. noob hopefully

Posted: Mon Nov 19, 2007 5:57 pm
by imstupid
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Thank god I found this site again. Hello everybody - long time. So, I moved off php for a while, and got back into the design side of things. Needless to say, I forgot a lot of things, and here we are today.

So I'm making this Widget for Mac OSX and I'm having trouble with 1 line of Javascript code. I'm trying to generate a link name using the getdate() var thing I don't really know much about. 

What's weird is it works for the img src= part of it, just not the OpenURLpart. I think I'm missing some curly brackets or back ticks or the use of a magic wand, who knows. Here's some code:

Broken:
[syntax="javascript"]document.getElementById("recipes").innerHTML= "<img id='recipelink' onclick='widget.openURL(\"http://www.example.com/\" + todaym + todayd + \".htm\");' src='nrs/" + todaym + todayd + ".png'>";
the .pngs show up great, just the link isn't working. hand cursor shows up, but is unclickable.

oh, and by the way, if I manually type in the html file name, it works fine:

Code: Select all

document.getElementById("recipes").innerHTML= "<img id='recipelink' onclick='widget.openURL(\"http://www.example.com/1019.htm\");' src='nrs/" + todaym + todayd + ".png'>";
Thats it. Thanks for the time. What else has been going on the past 8 months or so?


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Nov 19, 2007 8:02 pm
by hawleyjr
There is a chance the todaym + todayd are being added and not parsed. Throw an empty string between them and see what happens.

Posted: Mon Nov 19, 2007 8:24 pm
by imstupid
hey thanks for the response. I tried doing the empty string and no luck. Same scenario with the hand cursor, but no action. Thanks again for any help. It's driving me nutso.