?
Solved

Help needed changing javascript code to delete unnecessary code.

Posted on 2014-11-25
7
Medium Priority
?
110 Views
Last Modified: 2014-11-25
Hi,

I have a devision panel on my form called "counter" and the appearance set in the css:

#counter {
	position:absolute;
	left:10px;
	top:112px;
	width:150px;
	height:22px;
	text-align: left;
	color: #FFFFFF;
	font: 12px "Trebuchet MS", arial, sans-serif;
	font-weight: bold;
	z-index:6;
}

Open in new window


And on the devision "counter" I have inserted a javascript. that looks like this:

<!-- Begin

var showdate	= "yes"		// SHOW THE DATE ON THE PAGE

// START DATE SCRIPT

if (showdate == "yes") 
{
document.write('<div id="date-location">');
var d=new Date();
var weekday=new Array("Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag");
var monthname=new Array("januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december");
document.write("<span class=\"date-font\"><nobr>" + weekday[d.getDay()] + " ");
document.write(d.getDate() + " ");
document.write(monthname[d.getMonth()] + " ");
document.write(d.getFullYear());
document.write("</nobr><br></span>");
document.write('</div>');
}
else {
document.write('&nbsp;<br>');
}
document.write('</td><td align="right">');

//  End -->

Open in new window


The code was used with tables , but I don't use tables anymore now I use devisions. What code
can be erased? And I don't use division "date-location" and class "date-font" anymore so that
should be erased too. Can anyone help me to change the code because its to hard for me to
understand. And the appearance of the devision cannot be changed.

Who can help me with erased the unnecessary code?

Greetings,
Peter Kiers
0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 58

Expert Comment

by:HainKurt
ID: 40464596
I guess you can delete Line 20-21-22-23-24 and put ";" at the end of line 19
0
 
LVL 1

Author Comment

by:peterkiers
ID: 40464603
Oke and what about the declarartion of  "date-location" and class "date-font" that i don't use anymore? p.
0
 
LVL 58

Expert Comment

by:HainKurt
ID: 40464626
document.write('<div id="date-location">');

can stay as is... or

document.write('<div>');

document.write("<span class=\"date-font\"><nobr>" + weekday[d.getDay()] + " ");
>>>
document.write("<span><nobr>" + weekday[d.getDay()] + " ");
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 58

Expert Comment

by:HainKurt
ID: 40464636
a bit confused... where is "id=counter"?

maybe you should do this:

document.write('<div id="date-location">');
>>>
document.write('<div id="counter">');
0
 
LVL 58

Accepted Solution

by:
HainKurt earned 1000 total points
ID: 40464644
if you are writing all code above inside div id=counter, then you can delete these two lines as well...

document.write('<div id="date-location">');
document.write('</div>');

assuming you are doing this:

<div id="counter">
>>> script above comes here <<<
</div>
0
 
LVL 1

Author Comment

by:peterkiers
ID: 40464660
Thank it works fine. Greetings, Peter Kiers
0
 
LVL 58

Expert Comment

by:HainKurt
ID: 40464679
why average? should I connect to your server and do all typing & test myself to get "Excellent" :)

and you got the answer in 25 minutes (time between first post & the one which is accepted)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question