trying to get the LINK title to change

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 717 Views - Last Post: 19 February 2013 - 03:15 AM

#1 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

trying to get the LINK title to change

Posted 18 February 2013 - 12:23 AM

well this is what I have so far
function writeMonthTitle(calendarDay) {
   var monthName = ["January", "February", "March", "April", "May", 
   "June", "July", "August", "September", "October", "November", "December"];

   var thisMonth=calendarDay.getMonth();

   document.write("<tr>");
   document.write("<th class='monthly_title' colspan='7'>");
   document.write('<a href="' + monthName[thisMonth] + '">monthName</a>');
   document.write("</th>");
   document.write("</tr>");
}


What i have that I am trying to get working correctly. I got the begging portion to pull up correctly i.e.
to call the different months but still doesnt actually link to the proper htm files properly. Also I am trying to display the month name on the calendar I am making and I can't seem to get it to call monthName properly to display the months on the calendar. It just says monthName at the top of every month. Is there any way to change that. also how to i get it to call the say "January.htm" file and so forth. or would I need to actually change the array to say .htm just curious and thank you for the help when it arrives.

Is This A Good Question/Topic? 0
  • +

Replies To: trying to get the LINK title to change

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: trying to get the LINK title to change

Posted 18 February 2013 - 12:41 AM

View Postplaguebearer, on 18 February 2013 - 08:23 AM, said:

I got the begging portion to pull up correctly i.e. to call the different months but still doesnt actually link to the proper htm files properly.

why should it. the only part you write into the href is the monthís name. there is no file extension added anywhere.


View Postplaguebearer, on 18 February 2013 - 08:23 AM, said:

Also I am trying to display the month name on the calendar I am making and I can't seem to get it to call monthName properly to display the months on the calendar. It just says monthName at the top of every month.

because thatís what you have coded.
// line #9, the content of the link is a fixed string
<a href="...">monthName</a>

Was This Post Helpful? 0
  • +
  • -

#3 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

Re: trying to get the LINK title to change

Posted 18 February 2013 - 12:57 AM

so would i be able to parse it from a fixed string into say reading the array back out to list the months. would that possibly work.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: trying to get the LINK title to change

Posted 18 February 2013 - 02:01 AM

you would just have to use a variable value instead of a fixed string.
Was This Post Helpful? 0
  • +
  • -

#5 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

Re: trying to get the LINK title to change

Posted 18 February 2013 - 02:05 AM

ok I will give it a shot. i have been starring at this for a couple hours now. Thank you for the help. I really appreciate it.
Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: trying to get the LINK title to change

Posted 18 February 2013 - 04:48 AM

Are you being taught to use document.write? If so, that's pretty behind the times.
Was This Post Helpful? 0
  • +
  • -

#7 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

Re: trying to get the LINK title to change

Posted 18 February 2013 - 04:50 AM

yeah that is what our textbook uses. is there a simpler way. this is the advanced web design class. haha. it would be nice to find out a better way to help the professor. his first time teaching this class.
Was This Post Helpful? 0
  • +
  • -

#8 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

Re: trying to get the LINK title to change

Posted 19 February 2013 - 01:20 AM

I just want to say thank you all for the help that you provided. I talked with some of the other guys at school and they said my quotes were in the wrong places and misused. here is the updated code that works with what I was trying to do. by the way what was the newer way to use document.write for the code.

function writeMonthTitle(calendarDay) {
   var monthName = ["January", "February", "March", "April", "May", 
   "June", "July", "August", "September", "October", "November", "December"];

   var thisMonth=calendarDay.getMonth();

   document.write("<tr>");
   document.write("<th class='monthly_title' colspan='7'>");
   document.write("<a href='" + monthName[thisMonth] +".htm'>" + monthName[thisMonth] + "</a>");
   document.write("</th>");
   document.write("</tr>");
}



this thread is solved. thank you again for the help everyone.
Was This Post Helpful? 0
  • +
  • -

#9 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: trying to get the LINK title to change

Posted 19 February 2013 - 02:01 AM

View Postplaguebearer, on 19 February 2013 - 09:20 AM, said:

by the way what was the newer way to use document.write for the code.

there are several ways:
  • innerHTML - not part of any standard but universally supported. the string passed is interpreted as HTML source code and is inserted as child nodes.
  • textContent - sets the text of an Element (not supported in IE until (IIRC) IE9)
  • createTextNode() - basic DOM handling, similar to textContent, only much more basic and operating with Nodes directly.
  • CharacterData.data - if there is already a text node, this is the property that changes its text.
  • Node.nodeValue - same as above, only more generic (i.e. applies to all types of Nodes).

Was This Post Helpful? 2
  • +
  • -

#10 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

Re: trying to get the LINK title to change

Posted 19 February 2013 - 02:06 AM

i am going to print that to show my professor. you are saying it doesnt work in ie9. the book gave us a file called modernizer.js for ie that is supposed to make ie compatible with the newer code that we are writing so it doesnt get all crazy on us. then again maybe that is why we are using document.write. haha.
Was This Post Helpful? 0
  • +
  • -

#11 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: trying to get the LINK title to change

Posted 19 February 2013 - 02:10 AM

I said it works as of IE9 (IE9+).

though the given possibilities are a very condensed list. e.g. it doesnít give any examples. commonly, only the first two options are used (the others go too deeply into theory and are less convenient).
Was This Post Helpful? 1
  • +
  • -

#12 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: trying to get the LINK title to change

Posted 19 February 2013 - 02:18 AM

View Postplaguebearer, on 19 February 2013 - 10:06 AM, said:

the book gave us a file called modernizer.js for ie that is supposed to make ie compatible with the newer code that we are writing so it doesnt get all crazy on us. then again maybe that is why we are using document.write. haha.

Modernizr is more of a feature detection system, it doesnít modernize IE but helps you write modern code.

you should forget document.write(), there are a lot of problems associated with it that donít occur in beginner tutorials but shoot you in the foot as soon as you try to do non-beginner stuff with it (e.g. using document.write() inside an event handler or using it with XHTML).
Was This Post Helpful? 0
  • +
  • -

#13 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

Re: trying to get the LINK title to change

Posted 19 February 2013 - 02:27 AM

i have only learned a little XHTML. We are focusing on HTML5 and CSS3 with JS for this class. This is the last web design class that I can take with school. and I would like to get into designing and building sites or android dev or something with JAVA when I finish school in about 6 months. I am def a bigger fan of HTML5 than I am with XHTML. But like I said not to much experience with it. If you want to check out my site it is here's my site. just something easy for school. it is both the beginning class 385 and 386 that I am taking now. let me know what you think and anything that you would recommend me changing on there.

sorry the site thing didn't work. it's cmst385.browtecoding.com check it out and tell me what you think.
Was This Post Helpful? 0
  • +
  • -

#14 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: trying to get the LINK title to change

Posted 19 February 2013 - 02:52 AM

ok, but be prepared.
good points:
- nice background image
- content is clearly distinguishable (sensible layout)

errors:
- I donít have those background images (wrong URI, never use a local path)

typography:
- inconsistent use of fonts, donít mix serif and sans-serif fonts
- keep the font constant per element type (e.g. always the same font(-family) in a heading)

colors:
- well, brown ... (though thatís personal preference)
- navigation barís color is a mismatch (light blue vs brown)
- logo does not fit (black/green vs brown), additionally does not have its own space

source:
- the email image does not qualify for a heading

others:
- no space between navigation bar and content
- the apostrophe in the heading should be a typographical one (í instead of ')
- the menu could be multi levelled (e.g. accordion, Suckerfish and the like), personally I find it somewhat weird to scroll the menu but not the content
Was This Post Helpful? 0
  • +
  • -

#15 plaguebearer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-March 11

Re: trying to get the LINK title to change

Posted 19 February 2013 - 02:59 AM

yeah that is something that is still in the works and I will probably scrap it and start over once this class is over. or should I make the changes and keep it for a portfolio later on when applying for jobs. We just learned last week how to use JS to format the email so that harvesters cant get it and spam us to death so it is misspelled wrong. i just need to go and correct that. I could definately work on the colors quite a bit. But like i said just something that i threw together in about a week last term and have been updating it every week with new links to my homework that we do. The code that I had the question about is the newest link the review site that I was working on. I kind of like the idea of having the scroll on the sidebar there since there is not to much content else where to have to scroll. what do you think.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2