Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help With Button??

    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.

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    For starters, at least:
    Code:
    functoin rotateShadow()
    should be
    Code:
    function rotateShadow()

  • #3
    New to the CF scene
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    May 2007
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi theroo

    Check out this code:

    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>
    Forum for webmasters and developers
    http://www.htmlfrenzy.com
    Are you an IT expert? Join our Reward system
    www.htmlfrenzy.com/reward-system.php

  • #5
    New to the CF scene
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Regular Coder
    Join Date
    May 2007
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Forum for webmasters and developers
    http://www.htmlfrenzy.com
    Are you an IT expert? Join our Reward system
    www.htmlfrenzy.com/reward-system.php

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,633
    Thanks
    0
    Thanked 649 Times in 639 Posts
    You shouldn't use an <input> field outside a form. Try using a <button> i9nstead.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #8
    New to the CF scene
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    cool guys thanks, now i understand where i went wrong.

  • #9
    Banned
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #10
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy mr

    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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •