Solved

Help needed changing javascript code to delete unnecessary code.

Posted on 2014-11-25
7
101 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 52

Expert Comment

by:Huseyin KAHRAMAN
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 52

Expert Comment

by:Huseyin KAHRAMAN
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 52

Expert Comment

by:Huseyin KAHRAMAN
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 52

Accepted Solution

by:
Huseyin KAHRAMAN earned 500 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 52

Expert Comment

by:Huseyin KAHRAMAN
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

730 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