2 Replies - 210 Views - Last Post: 07 July 2012 - 10:37 AM

#1 pegster  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 29-June 12

cleaning up script

Posted 07 July 2012 - 01:07 AM

Hello all,

Is there a way to clean up my script? I want to clean up the markup by moving all that repeated style info to the <style> element in the head. Any suggestion?


< form action = "" method = "post" name = "lottoNum" >
 < p >
Lotto number
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #556B2F;" size = "10" name = "numbers0" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #556B2F;" size = "10" name = "numbers01" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #556B2F;" size = "10" name = "numbers02" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #556B2F;" size = "10" name = "numbers03" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #556B2F;" size = "10" name = "numbers04" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #556B2F;" size = "10" name = "numbers05" >
 < / p >

 < / form >

 < form action = "" method = "post" name = "lottoNum" >
 < p >
Lotto number
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B22222;" size = "10" name = "numbers0" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B22222;" size = "10" name = "numbers01" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B22222;" size = "10" name = "numbers02" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B22222;" size = "10" name = "numbers03" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B22222;" size = "10" name = "numbers04" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B22222;" size = "10" name = "numbers05" >
 < / p >

 < / form >
 < form action = "" method = "post" name = "lottoNum" >
 < p >
Lotto number
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #191970;" size = "10"  name = "numbers0" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #191970;" size = "10"  name = "numbers01" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #191970;" size = "10"  name = "numbers02" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #191970;" size = "10"  name = "numbers03" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #191970;" size = "10"  name = "numbers04" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #191970;" size = "10"  name = "numbers05" >
 < / p >

 < / form >
 < form action = "" method = "post" name = "lottoNum" >
 < p >
Lotto number
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B8860B;" size = "10"   name = "numbers0" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B8860B;" size = "10"  name = "numbers01" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B8860B;" size = "10"  name = "numbers02" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B8860B;" size = "10"  name = "numbers03" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B8860B;" size = "10"  name = "numbers04" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #B8860B;" size = "10"  name = "numbers05" >
 < / p >

 < / form >
 < form action = "" method = "post" name = "lottoNum" >
 < p >
Lotto number
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #FF4500;" size = "10" name = "numbers0" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #FF4500;" size = "10" name = "numbers01" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #FF4500;" size = "10" name = "numbers02" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #FF4500;" size = "10" name = "numbers03" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #FF4500;" size = "10" name = "numbers04" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #FF4500;" size = "10" name = "numbers05" >
 < / p >

 < / form >
 < form action = "" method = "post" name = "lottoNum" >
 < p >
Lotto number
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #9932CC;" size = "10" name = "numbers0" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #9932CC;" size = "10" name = "numbers01" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #9932CC;" size = "10" name = "numbers02" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #9932CC;" size = "10" name = "numbers03" >
 < input type = "text" STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #9932CC;" size = "10" name = "numbers04" >
 < input type = "text"STYLE = "color: #F0F8FF; font-family: Comic Sans MS; font-weight: bold; font-size: 14px;                                background-color: #9932CC;" size = "10" name = "numbers05" >

 < / p >
 < / form >

 < p / >
 < input type = "button" value = " Generate " id = "reload" onclick = "lottery()" >
 < input type = "button" value = "Reset" onclick = "window.location.reload()" >
 < p / >
 < / form >




Is This A Good Question/Topic? 0
  • +

Replies To: cleaning up script

#2 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 4948
  • View blog
  • Posts: 11,353
  • Joined: 16-October 07

Re: cleaning up script

Posted 07 July 2012 - 02:01 AM

I don't see any script here?

From what I do see, a style sheet would do you a world of good:
.text1, .text2 {
	color: #F0F8FF;
	font-family: Comic Sans MS;
	font-weight: bold; 
	font-size: 14px;
}
.text1 { background-color: #556B2F; }
.text2 { background-color: #B22222; }



<form method = "post" name = "lottoNum">
	<p>Lotto number
		<input type="text" class="text1" size="10" name="numbers0" />
		<input type="text" class="text1" size="10" name="numbers01" />
		<input type="text" class="text1" size="10" name="numbers02" />
		<input type="text" class="text1" size="10" name="numbers03" />
		<input type="text" class="text1" size="10" name="numbers04" />
		<input type="text" class="text1" size="10" name="numbers05" />
	</p>
</form>

<form method = "post" name = "lottoNum">
	<p>Lotto number
		<input type="text" class="text2" size="10" name="numbers0" />
		<input type="text" class="text2" size="10" name="numbers01" />
		<input type="text" class="text2" size="10" name="numbers02" />
		<input type="text" class="text2" size="10" name="numbers03" />
		<input type="text" class="text2" size="10" name="numbers04" />
		<input type="text" class="text2" size="10" name="numbers05" />
	</p>
</form>



With everything the same name, I'm not sure how you keep track of anything. It looks like you might want a table. If you're actually using javascript, you might want to generated it.
Was This Post Helpful? 1
  • +
  • -

#3 pegster  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 29-June 12

Re: cleaning up script

Posted 07 July 2012 - 10:37 AM

Thank you, I finally did do that. Yes, I am doing javascript.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1