Help needed changing javascript code to delete unnecessary code.


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

#counter {
	text-align: left;
	color: #FFFFFF;
	font: 12px "Trebuchet MS", arial, sans-serif;
	font-weight: bold;

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


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()] + " ");
else {
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?

Peter Kiers
Peter KiersOperatorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HainKurtSr. System AnalystCommented:
I guess you can delete Line 20-21-22-23-24 and put ";" at the end of line 19
Peter KiersOperatorAuthor Commented:
Oke and what about the declarartion of  "date-location" and class "date-font" that i don't use anymore? p.
HainKurtSr. System AnalystCommented:
document.write('<div id="date-location">');

can stay as is... or


document.write("<span class=\"date-font\"><nobr>" + weekday[d.getDay()] + " ");
document.write("<span><nobr>" + weekday[d.getDay()] + " ");
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

HainKurtSr. System AnalystCommented:
a bit confused... where is "id=counter"?

maybe you should do this:

document.write('<div id="date-location">');
document.write('<div id="counter">');
HainKurtSr. System AnalystCommented:
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">');

assuming you are doing this:

<div id="counter">
>>> script above comes here <<<

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Peter KiersOperatorAuthor Commented:
Thank it works fine. Greetings, Peter Kiers
HainKurtSr. System AnalystCommented:
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)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.