Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on 

Help needed changing javascript code to delete unnecessary code.

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
JavaScript

Avatar of undefined
Last Comment
HainKurt
Avatar of HainKurt
HainKurt
Flag of Canada image

I guess you can delete Line 20-21-22-23-24 and put ";" at the end of line 19
Avatar of Peter Kiers
Peter Kiers
Flag of Netherlands image

ASKER

Oke and what about the declarartion of  "date-location" and class "date-font" that i don't use anymore? p.
Avatar of HainKurt
HainKurt
Flag of Canada image

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()] + " ");
Avatar of HainKurt
HainKurt
Flag of Canada image

a bit confused... where is "id=counter"?

maybe you should do this:

document.write('<div id="date-location">');
>>>
document.write('<div id="counter">');
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Peter Kiers
Peter Kiers
Flag of Netherlands image

ASKER

Thank it works fine. Greetings, Peter Kiers
Avatar of HainKurt
HainKurt
Flag of Canada image

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)
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo