Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
itiel shwartz2,440 Points
hi, i just started using js and i try adding date to my web, i used this code : __extrnal script___ var mydate=new Date() var year=mydate.getYear() if (year < 1000) year+=1900 var day=mydate.getDay() var month=mydate.getMonth() var daym=mydate.getDate() if (daym<10) daym="0"+daym var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") document.write("<font color='fffff' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+ "</b></font>")
and imported it using (in my html website): <p><script src="js/datescript.js" id="sc"></p> now i want the text to look like p in my css, how do i do it?
thank you, itiel.
I'm not sure if your code runs, but to answer the question about getting a string to be styled as a paragraph element you could do the following:
document.getElementById('date_paragraph').innerHTML = 'your string';