OK, So I am trying to create a widget and widget creation page for folks in the recovery community...so far I have been able to make the widget I want, not I am on to the user generated portion.... I am troublshooting how to do this...as I am a newb....I have a script that will give me the days based on a value, like so: <a style="color: transparent; text-decoration:none;" href="http://www.rehabilitation-center.org"><img src="http://www.rehabilitation-center.org/images/recovery.png" width="80" height="15" alt="recovery from addiction and alcohol" longdesc="http://www.rehabilitation-center.org" /></a> </div> <div align="center"> <script> /* Count up from the date */ var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") function countup(yr,m,d){ var today=new Date() var todayy=today.getYear() if (todayy < 1000) todayy+=1900 var todaym=today.getMonth() var todayd=today.getDate() var todaystring=montharray[todaym]+" "+todayd+", "+todayy var paststring=montharray[m-1]+" "+d+", "+yr var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1) difference+=" days" document.write("I\'ve been sober for <strong>"+difference+"</strong>!") } //enter the count up date using the format year/month/day countup(1988,04,14) </script> </div> Code (markup): So, that will produce what is seen on this page: http://www.rehabilitation-center.org/rehabwidget.html Now I am going to try to make this so that 2 things happen: 1.) The user comes to a page with a form on it, all they have to fill out is their date of recovery...so it would be in the year, month, day format like: countup(1988,04,14) Code (markup): part of the script... so, really simple form, they enter day month year and it gets automatically inserted into the javascript file 2.) The form upon submit would give them a code that they can use as a widget on their page NOTE: I was thinking maybe the form would generate a js file specific to their date and then store it in a directory like /jsdates/ then call that specific file when the user puts the code on their site...is this a bad way to go about it? I am up for any improvements, suggestions or ways I can accomplish this...I am assuming JS is the best language for this but I could be wrong. Thanks in advance!!
You could go about it adding querystrings into the equation: http://www.rehabilitation-center.org/rehabwidget.html?y=1984&m=04&d=14 or http://www.rehabilitation-center.org/rehabwidget.html?d=19840414 Then you could grab these values(using JS) and pass it to your countup method. Worth doing some error checking on the values Hope this helps Si
ok i FIGURED THAT PART OUT....http://userbility.net/begin.php Now I am left with not knowing how to post the SOURCE code of the page into the iframe....kind of like the way this happens: http://www.webuildpages.com/iframed...w.mayandoomwebsite.com'>MayanDoomsday.com</a> If you go through the steps of my little widget thingy then you will see what I am saying...." click here to get code" just sends a phpinfo request to the iframe for fun- doesnt mean anything...I really want that frame to contain something like this: <iframe name="frame" style="height:50px;width:250px;border:0;"> My name is Sean and I am an alcoholic with <script> /* Count up from the date */ var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") function countup(yr,m,d){ var today=new Date() var todayy=today.getYear() if (todayy < 1000) todayy+=1900 var todaym=today.getMonth() var todayd=today.getDate() var todaystring=montharray[todaym]+" "+todayd+", "+todayy var paststring=montharray[m-1]+" "+d+", "+yr var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1) difference+=" days" document.write("<strong>"+difference+"</strong> sober!") } //enter the count up date using the format year/month/day countup(1983,12,13) </script> </iframe> Code (markup):