Google Answers Logo
View Question
 
Q: Looping ang changing background color of the page using vbscript ( No Answer,   1 Comment )
Question  
Subject: Looping ang changing background color of the page using vbscript
Category: Computers
Asked by: leo_chris-ga
List Price: $20.00
Posted: 23 Jul 2004 04:19 PDT
Expires: 09 Aug 2004 09:38 PDT
Question ID: 378041
the first problem is i have to input two numbers then loop
 the min no. is 1
 the max no. is 20
 the 2nd problem is i have to create a pop up menu of colors. After i
click 1 color the entire page background will change its color.

The style of the page is ready.Just modify the program in looping and
in changing the background color of the page. Also create another in
changing color but now using buttons not a pop up menu. Add it at the
buttom of the page after the pop up menu.


This is the program i created pls edit this to a new a right one!!

<html>
<head>
</head>
<body>
<SCRIPT LANGUAGE="VBScript">

dim ans
dim x
dim y
dim total

sub add1_onclick()
	
	x=(form.value1.value) 
	y=(form.value2.value)
	do while loop x>y
	total=x+1
	loop
	ans=total
	alert(ans)
end sub

</SCRIPT>

<form id=form>
<pre>
<p><b>Input Two Numbers</P></b>
Number 1: <input type="text" id="value1" ><br>
Number 2: <input type="text" id="value2" ><br><br>
</pre>
<input type="button" value="Compute" id="compute"><br><br>
<br>
<p><b> Select a Background</b></p>
<select name ="color" size="1" id="bg">
<option selected>Blue
<option >Yellow
<option >Red
<option >Green
<option >Orange
</select>
</form>
</body>
</html>

I'll check it tommorow! i need the program until Sunday July 25, 2004
because this is my project in midterm. I know this is easy for experts
^__^ see yah
Answer  
There is no answer at this time.

Comments  
Subject: Re: Looping ang changing background color of the page using vbscript
From: amallami-ga on 23 Jul 2004 06:29 PDT
 
you're loop requires more spec (as i don't really know what you expect
to do with it, but in your original code, it will loop infinitely if
you put a larger number in the first field...  updated the other part
of the code.

---------------------------------------------

<html>

<head>

</head>

 

<body onload=color1_onChange()>

<SCRIPT LANGUAGE="VBScript">

<!--

sub compute_onclick()

            dim x

            dim y

            dim ans

            dim total

 

            x= form1.value1.value

            y= form1.value2.value

            do while x>y

                        total = total + x + 1

                        x = x + 1

            loop

            ans=total

            alert(ans)

end sub

sub color1_onChange()

            document.bgcolor=form1.color1.Options(form1.color1.SelectedIndex).Value

end sub

//-->

</SCRIPT>

 

<form id=form1>

<pre>

<p><b>Input Two Numbers</P></b>

Number 1: <input type="text" id="value1"><br>

Number 2: <input type="text" id="value2"><br><br>

</pre>

<input type="button" value="Compute" id="compute"><br><br>

<br>

<p><b> Select a Background</b></p>

<select name="color1" size="1">

<option value="Blue" selected>Blue

<option value="Yellow">Yellow

<option value="Red">Red

<option value="Green">Green

<option value="Orange">Orange

</select>

</form>

</body>

</html>

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy