Got any Code Requests? Ask us here!

  • 1
  • Praise
  • Updated 7 years ago
Every once in a while, me and other people from my team will be helping anyone that needs a custom code on this post. Usually it will be two of us. This time, me and Nathan will be helping. We can do anything from HTML to server-side PHP.

PHP Requests

Due to Yola not supporting PHP, we will need to give you an iframe for anything written in PHP.

JavaScript Requests

We have a strong knowledge of JavaScript, so please do not hesitate to ask for a JavaScript code from us. JavaScripts can be directly in your site. (no iframes)

Note: We do not guarantee that we will be able to write the code that you want. But, still ask us even if you think we wont be able to write it for you!
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
  • excited to create, some, code!

Posted 7 years ago

  • 1
Photo of Annette Shaw

Annette Shaw

  • 2 Posts
  • 0 Reply Likes
thx guys
setting up buy it now on my website but when i copy and paste from pp to my site only rows of script/codes appear - pse can u help me to set up multiple purchase codes - yr help wld save me
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Make sure your adding it in a HTML widget.

Also if its a script. Then do this inside the html widget:


<script type="text/javascript">

//Script HERE

</script>


Please tell me if this help!
If not would you share the code so I can set it up for you.

Best Regards, Shawn
Photo of RSPublishing

RSPublishing

  • 298 Posts
  • 9 Reply Likes
Hi,

Are you using the HTML widget ?
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
This is a good topic, I'll be sure to ask, instead of making more topics.
Thanks for this!
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Your Welcome
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
I have a request, hopefully you will be able to answer it...

Is it possible to add a link to the banner image, I found that you can change the banner size using a html widget, so why not add a link?

Thanks.
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Tell me if it works!
It should work because I tested it, so if it doesn't please inform me

Best Regards,
Shawn
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
Amazing, I've just tried it, it worked perfectly!
May I ask how long have you been doing coding for?
And also, how do you give someone's reply a star? :D
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
I've been coding for a year now :D

Also just click:

"Good answer!" on the Post.
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
Ah, nice, but I can't find any Good Answer links/buttons here, on the Idea topic.
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
@Sajid-M: Actually, I just figured out you can't star anything on "Praise" topics.
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Sorry everyone for the Delay I will help you out right now.
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like
sup guys i have ar referral link and a image i took off the net and here is what i have(it's suppose to be a banner ad) but it doesn't work .i know it's close to what it should be.i was hoping you all could help me out.thx in advance

http://i283.photobucket.com/albums/kk... " width="468" height="60" border="0" />
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like
........... http://i283.photobucket.com/albums/kk... " width="468" height="60" border="0" /> ................
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like
lol i dont even know how to post it :(
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Hi,

Add you code in this:

<code>

//Code Here

</code>
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like
// http://i283.photobucket.com/albums/kk... " width="468" height="60" border="0" />
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
Could you put your code in:

<code>
put code here
</code>


That will display it properly.

The output of that would be:


code here



Regards,
Nathan
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like

<a href=http://bit.ly/p3acQ3 target="_blank"><img> http://i283.photobucket.com/albums/kk305/mypayments/beezag.gif<img> " width="468" height="60" border="0" /></a>
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like
aw man thx a million shawn! hey i only have 50 cents in my paypal but if you want it,it is yours. just let me know and thx gain!
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
No,
I don't accept money. I just love helping others, but thanks for the offer.
You can ask for as much as you want on this post and we will make sure you get it, for free! :)
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like
awesome! i vouche for nathan and shawn. they are both fast,friendly,and most importantly, part of our rapidly growing yola family
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Aww, Thanks!

Glad to Help,
Shawn
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
Thanks hiphopherion! :) We are happy to help you and all of the others on this forum.

Kind regards,
Nathan
Photo of www.hiphopheroin.com

www.hiphopheroin.com

  • 84 Posts
  • 1 Reply Like
yes! finally thax nathan and shawn!!!!
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Many thanks to Nathan and Shawn for diligently helping out!
Photo of Amar

Amar

  • 201 Posts
  • 14 Reply Likes
Hi,

Is there a code for identifying iPhone/iPod/iPad and Android users and redirecting them to a mobile site?

Amar
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Amar,
Yes, there is.

Add this to your site in an HTML widget:



<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
<script type="text/javascript">
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) { document.location = "REDIRECT LINK GOES HERE"; }
</script>

Photo of Gop

Gop

  • 189 Posts
  • 54 Reply Likes
Crashed my index and remarkably it was recovered automatically with the new name of "null". I was pushing it hard by trying to include some codes in the menu navigation. It seemed to work on a trial page but didn't on the index page.

So now I wonder if I can create some css for the formating such as size and a transclucent background screen and then simply pull it into a single HTML reference within the Menu Nav. Not game to do that based on the experience earlier but would be grateful for any leads.

I am also using a web-font from Google and a Size jump in the menu nav.

The code I'm using for the background screen is:


<style>
#transparency {
background-color: rgba(0,51,51,0.8);
filter: alpha(opacity=80);
opacity: 0.8;
}
</style>


I used part of this inline previously.

Using style "squeaky clean"

Thank you Shawn and coders.
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Hello Gop,

I am not sure that I understand what you want. Could you explain what you want a little more?
Photo of Gop

Gop

  • 189 Posts
  • 54 Reply Likes
Hello Shawn,

Thank you for responding to this.

I wish to modify the navigation menu within the "squeaky clean style".

I would like to change the font colour & size, use a web-font and use a translucency screen or background under the font. I wasn't able to successfuly do this with the nav menu using inline css with a mix of simple HTML.

I was wondering if there would be a way to produce a style sheet for this and then just call the style into the navigation menu.

I've given the css for the translucency screen above as this works very well and I believe is cross browser inclusive. I have used it in other parts of the site.
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Where do you want to add the translucency screen? To the Menu? Sorry that i'm not understanding
Photo of Gop

Gop

  • 189 Posts
  • 54 Reply Likes
Yes to the Menu. Not just the translucency screen but also font colour, font size and a web-font all for the Menu. Thank you Shawn
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
Hello Gop,

I'm going to help you on this one :)

Do you mean a transparent background on your menu? The reason why we're a little confused is because we don't know if you want it to be transparent or translucent.

There is a way to produce a style sheet for this, but I just need to know what colors you want, if you want it transparent or translucent, etc.

Also, could you provide a URL to your site so I can see what your menu looks like right now and so I can get some class names to style it?

Thanks,
Nathan
Photo of Gop

Gop

  • 189 Posts
  • 54 Reply Likes
Thanks Nathan,

Translucent.
Screen color: rgb(0,51,51).
The screen is only applying to the menu not to the entire page.

The rest can be set in a generic form as I don't have the site published as yet.

Here is the code that I have used in the markup of other elements of the site (you can change the word transparency to translucency if you wish. )

#transparency {
background-color: rgba(0,51,51,0.8);
filter: alpha(opacity=80);
opacity: 0.8;
}
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
Hi Gop,

I got it done: http://gopmenu.yolasite.com/

Is that how you wanted it? If so, you can copy that code and make the changes you want. I added comment tags in it so it will be a lot easier to understand which parts are which, if you didn't know.

If you have any questions, please let me know. :)

Kind regards,
Nathan
Photo of Gop

Gop

  • 7473 Posts
  • 2115 Reply Likes
Thank you Nathan. I can use this and only needed to make one change to a name. It works very well and I am very grateful.

One thing that has come about is that the text and the screen colour are blending of course because they are on the same level I presume. Is it possible to separate the z-levels so that the screen is behind the text? I think this would then be it.

The issue is that I have an image as a background and it varies dramatically in light and dark colours. The screen adds a bit of uniformity and blends satisfactorily with the green colours of the image. This then allows me to use a yellow or lime green for the text. The colour of the texts flattens noticeably because of the same depth of field I guess.
Photo of JC

JC

  • 354 Posts
  • 15 Reply Likes
Shawn/Nathan - been away and just back to community. What a fantastic offer A HUGE thank you must be in order.
JC
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Why Thanks! :)
Photo of Josh Cordoba

Josh Cordoba

  • 12 Posts
  • 0 Reply Likes
Hi,
I need help integrating an API from an external source into my site. Can you guys help me do this? I have the code but I'm not sure if Yola supports this type of function.

any help would be appreciated, thanks,

SC
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Yes, we can help.

Want kind of code is it though?

Best Regards,
Shawn
Photo of Bernhardt

Bernhardt

  • 70 Posts
  • 0 Reply Likes
Hi there guys

I am looking for some code... If someone were to enter my site I want a little pop-up window to pop-up first before they browse the site... I want to use it to let users know of new updates or specials or something in that direction... I must be able to edit the text myself after you helped me please... Also you can have a look at my site and maybe make the border of the window the same blue as my coulor scheme... if possible at all?

www.helderbergads.com

Thanks a lot....
Bernhardt
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Code Tutorial.

Setup

First we will want to add the two codes needed to make the codes work inside an HTML widget:


<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://weebuild.biz/resources/box.js"></script>



I will be hosting the code so if you think the code will need fix I can do it and republish it.

Next you will want to add the Options(We will talk more about it below):


<script type="text/javascript">
Cookies = 'Off';
Cookie_Name = 'try150';
Box_Width = '470';
Box_Height = '290';
Padding = '10';
Shadow_Color = '#0566B5';
Shadow_Blur = '10';
Border_Radius = '4';
Border_Color = '#0766B4';
Border_Width = '1';
Border_Type = 'solid';
Text_Color = '#000000';
Background_Color = '#ffffff';
Overlay_Color = '#015A7D';
Overlay_Opacity = '60';
Box_Opacity = '99';
Close_Button = 'http://www.mattcmiller.net/css/images/close_button.png';
</script>



Last you will need to add the html:


<div id="whats_new" style="display:none;">
<h2 id="top">Special Offers</h2>
<span style="font-size:25px;">Offer 1</span><br>
<span style="font-size:19px;color:grey;">Offer 1 Description</span><br><br>
<span style="font-size:25px;">Offer 2</span><br>
<span style="font-size:19px;color:grey;">Offer 2 Description</span><br><br>
<span style="font-size:25px;">Offer 3</span><br>
<span style="font-size:19px;color:grey;">Offer 3 Description</span><br><br>
<center id="copy">Copyright © {YEAR} {COMPANY}. All Rights Reserved</center>
<br><div id="last" style="float:right;"></div>
<div id="close"></div>
</div> <div id="over"></div>



I have made it so you can easily edit it.

When your done with the setup you should get this:



Usage

We got lots of options.
Most of them are pretty self explanatory.

Two really important ones are:

Cookies and Cookie_Name

The Cookies part is where you turn the Showing only once On and Off.

It is called Cookie because that's the actual term for Browser saving.

If you turn it on. Then the box will only show once on each computer.

Cookie_Name is only need is Cookies is On.

This might be a little complicated but, if you have cookies on. Every time you do changes on the Boxes content you will need to change the words inside Cookie_Name before you publish your site. You don't need to change it everytime you click the save button in the HTML editor This can be any name. You just need to make sure you never used the name before.

We also have a lot of options to change the style!

For example, Close_Button is the URL to a Close button. I already have an URL in there and I think it looks great at the moment. But you can change it.

Also, I personally don't think you should change the Box_Width or Box_Height because I positioned the box so it is in the middle so if you change the width and/or height then the box wont be centered anymore.

Please just play around with the other options. I made it so I didn't have to style it but you can. If you have questions, please ask!

Edit:
There is also a cool feature where it shows the last time you edited it so your users know.


Enjoy!,
Shawn
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Little Update, Now Version 1.1 is release. All I did it make the HTML better.

Use this instead:


<div id="whats_new" style="display:none;">
<h2 id="top">Special Offers</h2>
<span style="font-size:25px;">Offer 1</span><br>
<span style="font-size:19px;color:grey;">Offer 1 Description</span><br><br>
<span style="font-size:25px;">Offer 2</span><br>
<span style="font-size:19px;color:grey;">Offer 2 Description</span><br><br>
<span style="font-size:25px;">Offer 3</span><br>
<span style="font-size:19px;color:grey;">Offer 3 Description</span><br><br>
<center id="copy">Copyright © {YEAR} {COMPANY}. All Rights Reserved</center>
</div>

Photo of Bernhardt

Bernhardt

  • 70 Posts
  • 0 Reply Likes
Oh that looks fantastic... you are right its better than I ever expected... Ive gone through all the code and stuff and I can see all the changes I can make which is fantastic.. really awesome... I think the size would be fine too... I only want to ask the following...

I am not clued up with these things so here goes:

-Should I paste these codes in separate HTML widgets or in the same one with spaces between the codes or how do I go about it?

I love the fact of the 'offer' and then also the description part. You really thought this out and it was worth the wait. Cant wait to start playing around with it....
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
Wow it looks nice, I'll try it on mine later!
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
You can past this all on the same HTML widget.

You should separate it for better organization.

Note: When you done with setting up the code you will see a little box on the page. This is just the blur (Background Overlay) and will display correctly on the page.

Also find this line: Cookie_Name = 'try150';
This is the cookie name I used and should be changed first.

It took me over 150 tries to get this code to work. That's why the name of the cookie was try150.


Best Regards,
Shawn
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
Hi,

I have a code request, I want to be able to add more than one expand link on a page, I don't know the official name but there is a topic here that explains it further:
http://forum.yola.com/yola/topics/is_...

Thanks.
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Yes, you can.

It uses ids you are going to need to change them.

IDS cant start with a Number

I will show you how.

1. Find this line:

<p id="already-here-p">

2. Change already-here-p to something else.

3.

A. Find the code:

<a href="#" id="show-more-link" onclick="document.getElementById('extend-section').style.display='block'; this.style.visibility='hidden'; return false;">[show more]</a>

B. Find show-more-link and replace it with whatever you want.

C. Find already-here-p inside the code above. And Change it with the work you use for number 2.

6. Next find this code:

<div id="extend-section" style="display:none;">

7. Find extend-section and change it to what you want.

8. Find already-here-p, show-more-link, extend-section

In this code:

<a href="#" onclick="document.getElementById('extend-section').style.display='none'; document.getElementById('already-here-p').style.display='block'; document.getElementById('show-more-link').style.visibility='visible'; return false;">[show less]</a>


9. Replace already-here-p with the name you picked on Number 2. Replace show-more-link with what ever name you put for Number 3, B.
Last, find extend-section and replace it with whatever you put for on Number 7

Example:



<p id="Number_1">

Your text that is already showing can be here.

<a href="#" id="Number_2" onclick="document.getElementById('Number_3').style.display='block'; this.style.visibility='hidden'; return false;">[show more]</a>

</p>

<div id="Number_3" style="display:none;">

<p>

First paragraph to show when "show more" link is clicked.

</p>

<p>

Second paragraph to show when "show more" link is clicked.

</p>

<br />

<a href="#" onclick="document.getElementById('Number_3').style.display='none'; document.getElementById('Number_1').style.display='block'; document.getElementById('Number_2').style.visibility='visible'; return false;">[show less]</a>
</div>



Please look through the example and maybe you can see what I mean by change name.

Best Regards,
Shawn
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
Sorry for taking so long, I was busy.
Thanks for your help, I'll try it now.
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
I've tried it, I understand what you mean and it worked perfectly!
Thanks again for your help!
Photo of Cath Murphy

Cath Murphy

  • 15 Posts
  • 0 Reply Likes
Comments: I like to have comments on a new page instead of along with each podcast in our archive - it looks tidier. What I would love is to have the picture acting as the link to the comments page show the number of comments already left.

Here's an example:

http://www.wtfpod.com/podcast
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
I don't fully understand.
Photo of Cath Murphy

Cath Murphy

  • 15 Posts
  • 0 Reply Likes
Sorry - not very clear. In our podcast archive I would like people to be able to comment on each cast. But rather than have the comments appear in the archive itself (which messes up the tidy list of casts) I want a link to a separate page which holds the comments for that particular cast. I can do this by putting in a little "speech bubble" symbol next to the archive entry which links to another page where the comments live. In fact I've done it here: http://www.scribatious.biz/podcasts.php and click on the speech bubble.

But what I would really like is for the speech bubble to show the number of comments already left for that show. That's what happens on the wtfpod example I gave the link for above.

Does that make sense?
Photo of Cath Murphy

Cath Murphy

  • 15 Posts
  • 0 Reply Likes
Any chance you could take a look at this?
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
I have another code request.
Well, I have a code, but I don't know how to fully change it into what I want. It's for a feedback button the the left hand side, which at the moment is just a button, but I want it to stick out - expand when I hover my mouse over it, I edited the original code, and tried making a different picture for with onmouseover thingies, but it failed and I need help.

Here is the code:

<a style="display:scroll;position:fixed;bottom:330px;left:0px;" href="http://yourfirstwebsite.yolasite.com/feedback.php" target="_blank"><img src="http://i1181.photobucket.com/albums/x436/Sajid-M/FeedbackButton.jpg" onmouseover="http://i1181.photobucket.com/albums/x436/Sajid-M/FeedbackButton.jpg "/></a>


I want the button stick out slightly when mouse is hovered over it, I thought maybe I would need another picture which has a small white margin on it's left, but that's suspended unless I need it. I also want it to slide, not suddenly appear bigger, but whatever you can do which is similar is fine.

Thanks.
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
I have another code request, sorry for all of them, I've just had a lot of ideas recently. This one is hard :/

I want a html widget to count my website's age, to time, without having me to edit it all the time, I have found a few, one gives me the code, but it has advertisement and isn't exactly how I want it, the source for that is here:
http://www.delsearegional.us/academic...
I got it from here:
http://www.gmodules.com/ig/creator?sy...

There's another one here:
http://www.thepcmanwebsite.com/age.shtml

I don't know how to make it work, as I want mine in years and months, and even days, if it's possible, if not, tell me.

Thanks.
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
OK, got the code done.

Here is the example. Code is on the page. Plus HTML.

http://jsfiddle.net/shawn31313/kMfDK/3/

Best Regards,
Shawn
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
Thanks for this, but how exactly do I add it to my website?

I've tried putting the code, javascript and/or html in a html widget but it doesn't work, it just comes up with a lot of text.

Also, somewhere in the code, it says 'exsist', I think it's supposed to be 'exist', but I didn't edit past the line, surely these things matter?
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
You must add the script inside script tags.

Like this:


<script type="text/javascript">
//CODE HERE
</script>
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
The code still doesn't work for me so I'm going to paste it here so that you will be able to find any problems.

Here it is:


<script type="text/javascript">
<div id="hi">

-----

var Element = '#hi'; //eeee
var Day = 7; //Day your site was created
var Month = 9; //Month your site was created
var Year = 2011; //Year your site was created
var Style = 'color:black;'; //Optional! Style the words.
var Age_Style = 'Trebuchet-weight:bold;'; //Optional! Style the words.
var Display = 'This website has been active for {age}.'; //Words like: Years, Weeks, Days, Month are already added to
/*_____DONT__________________EDIT________________BEYOND________________________LINE
Thanks YOU! :)
*/
if (Day <= 0) {
$(Element).html('<span style="color:red;font-weight:bold;">Error!</span>');
$(Element).after('The Number of the Month goes from 1-30. You put ' + Day + '!');
}
if (Year <= 1799) {
$(Element).html('<span style="color:red;font-weight:bold;">Error!</span>');
$(Element).after('The Number of the Year can only go from 1800 and above. You put ' + Year + '!');
}
if (Month <= 0) {
$(Element).html('<span style="color:red;font-weight:bold;">Error!</span>');
$(Element).after('The Number of the Month goes from 1-12. You put ' + Month + '!');
}
if (Day && Month && Year > 0) {
var ager = getAge(new Date("" + Month + " " + Day + ", " + Year + " "));
Display = Display.replace(/{age}/, '<span style="' + Age_Style + '">' + ager + '</span>');
$(Element).html("<span style=" + Style + ">" + Display + "</span>");
}
if (Month === 1) {
Month = 'January'
}
if (Month === 2) {
Month = 'Febuary'
}
if (Month === 3) {
Month = 'March'
}
if (Month === 4) {
Month = 'April'
}
if (Month === 5) {
Month = 'May'
}
if (Month === 6) {
Month = 'June'
}
if (Month === 7) {
Month = 'July'
}
if (Month === 8) {
Month = 'August'
}
if (Month === 9) {
Month = 'September'
}
if (Month === 10) {
Month = 'October'
}
if (Month === 11) {
Month = 'November'
}
if (Month === 12) {
Month = 'December'
}

function getAge(birth) {
var now = new Date();
aSecond = 1000;
aMinute = aSecond * 60;
aHour = aMinute * 60;
aDay = aHour * 24;
aWeek = aDay * 7;
aMonth = aDay * 30;
var age = now.getTime() - birth.getTime();
if (age < 0) {
return "This site can't exsist"
}
years = (new Date(now.getTime() - aMonth * (birth.getMonth()))).getYear() - (new Date(birth.getTime() - aMonth * (birth.getMonth()))).getYear();
offsetNow = (new Date(now.getTime() - aDay * (birth.getDate() - 1)));
offsetBirth = (new Date(birth.getTime() - aDay * (birth.getDate() - 1)));
if (years > 1) {
months = years * 12 + (offsetNow.getMonth() - offsetBirth.getMonth());
}
else {
months = (now.getYear() - birth.getYear()) * 12 + (offsetNow.getMonth() - offsetBirth.getMonth());
}
agestr = "";
if (months < 24) {
weeks = Math.floor(age / aWeek);
age -= weeks * aWeek;
days = Math.floor(age / aDay);
if (weeks > 0) {
if (weeks == 1) {
agestr = agestr + weeks + " week ";
}
else if (weeks < 9) {
agestr = agestr + weeks + " weeks ";
}
else {
agestr = agestr + months;
if (now.getDate() - birth.getDate() > 10) {
agestr = agestr + " 1⁄2 ";
}
agestr = agestr + " months ";
}
}
if (days > 0) {
if (weeks < 9) {
if (weeks > 0) {
agestr = agestr + " and ";
}
if (days == 1) {
agestr = agestr + days + " day ";
}
else {
agestr = agestr + days + " days ";
}
}
}
}
else {
agestr = agestr + years;
if (months % 12 > 5 && years < 14) {
agestr = agestr + " 1⁄2 ";
}
agestr = agestr + " years ";
}
return agestr;
}
</div>
</script>

Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Hi.

You cant add:


<div id="hi">

-----



Inside script tags.

1. <div id="hi"> is HTML.
2. That div tag doesnt have an ending (</div>)
3. You cant add ----- to an script. Use /*****/ to separate a part of script.

I also forgot to give you the JQuery code which is needed for all my codes:

<script src="http://code.jquery.com/jquery-latest.js"></script>

So the full code would be:



<script src="http://code.jquery.com/jquery-latest.js"></script>
<div id="hi"></div>

0) {
var ager = getAge(new Date("" + Month + " " + Day + ", " + Year + " "));
Display = Display.replace(/{age}/, ''+ager+'');
$(Element).html("" + Display + "");
}
if (Month === 1) {
Month = 'January'
}
if (Month === 2) {
Month = 'Febuary'
}
if (Month === 3)
{
Month = 'March'
}
if (Month === 4) {
Month = 'April'
}
if (Month === 5)
{
Month = 'May'
}
if (Month === 6) {
Month = 'June'
}
if (Month === 7)
{
Month = 'July'
}
if (Month === 8) {
Month = 'August'
}
if (Month === 9)
{
Month = 'September'
}
if (Month === 10) {
Month = 'October'
}
if (Month === 11)
{
Month = 'November'
}
if (Month === 12) {
Month = 'December'
}
function getAge(birth)
{
var now = new Date();
aSecond = 1000;
aMinute = aSecond * 60;
aHour = aMinute * 60;
aDay = aHour * 24;
aWeek = aDay * 7;
aMonth = aDay * 30;
var age = now.getTime() - birth.getTime();
if (age < 0)
{
return "This site can't exsist"
}
years = (new Date(now.getTime() - aMonth * (birth.getMonth()))).getYear() - (new Date(birth.getTime() - aMonth * (birth.getMonth()))).getYear();
offsetNow = (new Date(now.getTime() - aDay * (birth.getDate() - 1)));
offsetBirth = (new Date(birth.getTime() - aDay * (birth.getDate() - 1)));
if (years > 1)
{
months = years * 12 + (offsetNow.getMonth() - offsetBirth.getMonth());
}
else
{
months = (now.getYear() - birth.getYear()) * 12 + (offsetNow.getMonth() - offsetBirth.getMonth());
}
agestr = "";
if (months < 24)
{
weeks = Math.floor(age / aWeek);
age -= weeks * aWeek;
days = Math.floor(age / aDay);
if (weeks > 0)
{
if (weeks == 1)
{
agestr = agestr + weeks + " week ";
}
else if (weeks < 9)
{
agestr = agestr + weeks + " weeks ";
}
else
{
agestr = agestr + months;
if (now.getDate() - birth.getDate() > 10)
{
agestr = agestr + " 1⁄2 ";
}
agestr = agestr + " months ";
}
}
if (days > 0)
{
if (weeks < 9)
{
if (weeks > 0)
{
agestr = agestr + " and ";
}
if (days == 1)
{
agestr = agestr + days + " day ";
}
else
{
agestr = agestr + days + " days ";
}
}
}
}
else
{
agestr = agestr + years;
if (months % 12 > 5 && years < 14)
{
agestr = agestr + " 1⁄2 ";
}
agestr = agestr + " years ";
}
return agestr;
}



Code Tested and it works! ;)
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
I think this is quite off-topic, but I'm thinking about making logos for people. I'm not good at it at all, but I'd love to try it.
I thought since your picture looks a little simple Shawn, maybe I could make another like this:


If this isn't quite what you want, then give me a font and describe it a little, this is for all the help you have given here!

I'd understand if you would want to keep your own picture as it is, but do tell me a way I can improve it.
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
Do you want the font bigger? Do you want to change the small line of shapes in the middle? Do you want a different font or colour? Would you like a red border around it like your previous one?
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Wow thanks this is cool!

I now changed it to this.
Photo of Sajid-M

Sajid-M

  • 119 Posts
  • 2 Reply Likes
I'm happy you like it :D
Photo of Shawn Holman

Shawn Holman

  • 486 Posts
  • 26 Reply Likes
Yes, Its very cool. :)