Advertisement

[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

03/11/2006 at 09:32PM PST, ID: 21770243
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

innerhtml question

Asked by -Dman100- in JavaScript

Tags: innerhtml, javascript

I have a function that uses document.write to generate html elments on my page.  The problem is when I call the function, all my other functions and html is lost.  I was reading that I can use innerhtml to prevent this.  I've never used innerhtml before.  Can anyone explain how I can use innerhtml in my function to prevent from losing all my other functions and html on my page?

Here is my javascript functions:

function PrevMonth() {
      var p = new Date();
      p.getMonth();
      p.setMonth(p.getMonth()-1);
      return p.getMonth();
}
function NextMonth() {
      var n = new Date();
      n.getMonth();
      n.setMonth(n.getMonth()+1);
      return n.getMonth();
}

function PrevYear() {
      var p = new Date();
      p.getYear();
      p.setYear(p.getFullYear()-1);
      return p.getYear();
}

function NextYear() {
      var n = new Date();
      n.getYear();
      n.setYear(n.getFullYear()-1);
      return n.getYear();
}

function daysInMonth(myDate) {
  var c = new Date(myDate);
  c.setDate(28);
  while(c.getMonth() == myDate.getMonth()) {
    c.setDate(c.getDate()+1);
  }
  c.setDate(c.getDate()-1);
  return c.getDate();
}

function Calendar() {

var day_name = new Array(7)
day_name[0] = "Sun"
day_name[1] = "Mon"
day_name[2] = "Tue"
day_name[3] = "Wed"
day_name[4] = "Thu"
day_name[5] = "Fri"
day_name[6] = "Sat"

var month_name = new Array(12)
month_name[0] = "January"
month_name[1] = "February"
month_name[2] = "March"
month_name[3] = "April"
month_name[4] = "May"
month_name[5] = "June"
month_name[6] = "July"
month_name[7] = "August"
month_name[8] = "September"
month_name[9] = "October"
month_name[10] = "November"
month_name[11] = "December"

var Date_Object = new Date()
Date_Object.setMonth(2);
var current_day = Date_Object.getDay()
var current_month = Date_Object.getMonth()
var current_year = Date_Object.getYear()
     if (current_year < 2000) {
          current_year += 1900
     }


var total_days = daysInMonth(Date_Object);

var first_day = (current_day - Date_Object.getDate() + 7) % 7 + 1;
var rows = (first_day + total_days) / 7
var pos = 0

document.write("<table border='1'><tr><td colspan='7'><a href='javascript:;' onClick='PrevMonth();'><<</a> " + month_name[current_month] + " <a href=''>>></a> <a href=''><<</a> " + current_year + " <a href=''>>></a></td><tr>")
document.write("<tr><td colspan='7'>" + month_name[current_month] + " " + current_year + "</td></tr>")
document.write("<tr>")
for(x = 0; x <= 6; x++) {
document.write("<td>" + day_name[x] + "</td>")
}
document.write("</tr>")
for(r = 0; r < rows; r++) {
document.write("<tr>")
for(d = 0; d <= 6; d++) {
pos++;
if ((pos > first_day) && (pos <= total_days + first_day))
document.write("<td><a href=''>" + (pos - first_day) +"</a></td>")
else
document.write("<td> </td>")
}
document.write("</tr>")
}
document.write("<tr><td colspan='7'>hours:minutes:seconds AM/PM</td></tr>")
document.write("</table>")
}


When I call Calender() all my other functions are lost.

Thanks for any help.
Regards,
-D-View the Solution FREE for 30 Days
[+][-]03/11/06 10:01 PM, ID: 16165951

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/11/06 10:25 PM, ID: 16165992

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/11/06 10:29 PM, ID: 16165998

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/12/06 07:21 AM, ID: 16167677

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/12/06 05:44 PM, ID: 16170706

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/13/06 12:59 AM, ID: 16172273

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: innerhtml, javascript
Sign Up Now!
Solution Provided By: amit_g
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03/13/06 09:43 AM, ID: 16176015

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090429-EE-VQP-58