...

View Full Version : Help With Button??



theroo
05-14-2007, 08:11 AM
hi i am a new and i am doing a CSS question for school but am having trouble with the button, when i click it the shadow is meant to change but doesn't.


<html>
<head>
<title>Question 3</title>

<script language="Java Script">
var theDirection=45;
var theColours=["lightblue"];
var thisColour=0;

functoin rotateShadow() {
the Direction=45;
text.filters("shadow") .direction=theDirection;
if (theDirection==360) {
theDirection=0;
}
}
</script>

</head>
<body>
<form>
<input type="button" value="Change Shadow"
<span onclick="rotateShadow()"></span>
</form>
<h1 id="text"
style="position:absolute; top:60; left:70;
font-family:Lucida Console; font-size:35pt;
color:lightblue; padding:11px;
filter:shadow(direction=-45, color=magenta)">
Shadow Filter Dynamically

</h1>
</body>
</html>

Thanks in advance i hope you can help.

PappaJohn
05-14-2007, 08:48 AM
For starters, at least:

functoin rotateShadow()
should be

function rotateShadow()

theroo
05-14-2007, 08:57 AM
looked that that thinking omg how stupid but changed it and nothing happened.

When i open it in IE after i click on the button, the "error on page" icon appears. When i click on details it says

Line:23
Char:1
Error:Object Expected
Code:0

smalldog
05-14-2007, 09:15 AM
Hi theroo :)

Check out this code:



<html>
<head>
<title>Question 3</title>

<script language="JavaScript">
var theDirection=45;
var theColours=["lightblue"];
var thisColour=0;

function rotateShadow() {
theDirection=45;
document.getElementById('text').filters("shadow").direction=theDirection;
if (theDirection==360) {
theDirection=0;
}
}
</script>

</head>
<body>
<input type="button" value="Change Shadow" onclick="rotateShadow();">
<h1 id="text" style="position:absolute; top:60; left:70;font-family:Lucida Console; font-size:35pt;color:lightblue; padding:11px;filter:shadow(direction=-45, color=magenta)">
Shadow Filter Dynamically
</h1>
</body>
</html>

theroo
05-14-2007, 09:27 AM
hi, thanks heaps that worked. Can i ask what you did to change it, it has been driving me insane trying to figure it out all day.

smalldog
05-14-2007, 09:43 AM
I changed just couple things..

1) As Pappa noticed functoin to function
2) the Direction=45; to theDirection=45;
3) text.filters("shadow") .direction to document.getElementById.filters("shadow").direction
4) I removed form and input
5) H1 styled to one line

felgall
05-14-2007, 11:05 AM
You shouldn't use an <input> field outside a form. Try using a <button> i9nstead.

theroo
05-14-2007, 12:49 PM
cool guys thanks, now i understand where i went wrong.

popoloco
05-30-2007, 03:37 PM
hi, thanks heaps that worked. Can i ask what you did to change it, it has been driving me insane trying to figure it out all day.

luis11zivalevo
03-25-2009, 11:48 PM
Hi i need help for this problem how i can implement this :when i click on the button of this script:i can see that the direction of shadow is changed but i need when i press the button to change also the color of the shadow not only the direction how i can make that
please someone help me?
THANKS!!!
<title>zadaca2</title>

<script language="JavaScript">
var theDirection=45;
var theColours=["green"+"red"];
var thisColour=0;

function rotateShadow() {
theDirection=45;
document.getElementById('text').filters("shadow").direction=theDirection;
if (theDirection==360) {
theDirection=0;
}
}
</script>

</head>
<body>
<input type="button" value="Change Shadow" onclick="rotateShadow();">
<h1 id="text" style="position:absolute; top:60; left:70;font-family:Lucida Console; font-size:35pt;color:black; padding:11px;filter:shadow(direction=-45, color=green,red)">
Shadow Filter Dynamically
</h1>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum