dcsimg
www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Thread: more alert boxes on one page...

  1. #1
    Join Date
    Jan 2009
    Posts
    30

    more alert boxes on one page...

    Dear All!
    I tried to put more alert boxes on one page and I got always the same alert clicking on each button!

    I ment it if I click the first to get the first alert, second button second alert, third button third alert,etc.
    But it did not work.

    What is the problem?
    How to solve?
    Many thanks!
    M

  2. #2
    Join Date
    Jan 2009
    Posts
    30
    Please, help someone!

  3. #3
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Show the code you have.

    Patience, we are giving of our free time to help others.

  4. #4
    Join Date
    Jan 2009
    Posts
    30

    Smile Here is the code! Many thanks!

    </script>
    <script type="text/javascript">
    function myfunction()
    {
    alert("Ana");
    }
    </script>
    <form>
    <input type="button" onclick="myfunction()" value="a)">
    </form>
    <script type="text/javascript">
    function myfunction()
    {
    alert("Marija");
    }
    </script>
    <form>
    <input type="button" onclick="myfunction()" value="b)">
    </form>
    <script type="text/javascript">
    function myfunction()
    {
    alert("Robert");
    }
    </script>
    <form><input type="button" onclick="myfunction()" value="c)">
    </form>

  5. #5
    Join Date
    Sep 2008
    Location
    On the Interweb
    Posts
    125
    You need to use unique identifiers for your functions

    Quote Originally Posted by marija View Post
    </script>
    <script type="text/javascript">
    function myfunctiona()
    {
    alert("Ana");
    }
    </script>
    <form>
    <input type="button" onclick="myfunctiona()" value="a)">
    </form>
    <script type="text/javascript">
    function myfunctionm()
    {
    alert("Marija");
    }
    </script>
    <form>
    <input type="button" onclick="myfunctionm()" value="b)">
    </form>
    <script type="text/javascript">
    function myfunctionr()
    {
    alert("Robert");
    }
    </script>
    <form><input type="button" onclick="myfunctionr()" value="c)">
    </form>

  6. #6
    Join Date
    Mar 2007
    Posts
    946
    Quote Originally Posted by Mayday View Post
    You need to use unique identifiers for your functions
    Or if you plan to use the same function over and over, but the string changes then pass the string in the parameters of the function.

  7. #7
    Join Date
    Sep 2008
    Location
    On the Interweb
    Posts
    125
    Or you could do that. Replace where I orinignally said "need to" with "could".

  8. #8
    Join Date
    Jan 2009
    Posts
    30

    Getting crasy with simple "thow"...



    Dear All!
    Thank You!
    But I don tknow what are her ethe identifiers!
    Sincerely,
    M


    (It shoudl be 3 buttons, pressing each should activate another answer on alert box!)

  9. #9
    Join Date
    Mar 2007
    Posts
    946
    Quote Originally Posted by marija View Post


    Dear All!
    Thank You!
    But I don tknow what are her ethe identifiers!
    Sincerely,
    M


    (It shoudl be 3 buttons, pressing each should activate another answer on alert box!)
    The doesn't make sense. I can't even figure out what you were going for there.

  10. #10
    Join Date
    Jan 2009
    Posts
    30

    Absolute beginner

    I appologose, started with that acutaly yesterday. Made a page with throw, sorry, and this should be function immitatin the alert box order! (withthe same effect!)
    Please if u can help me with translation to the dummies speech!
    THAK U ALL!
    M

  11. #11
    Join Date
    Jan 2009
    Posts
    30

    Please, what is identifier?

    What is identifier?

  12. #12
    Join Date
    Mar 2007
    Posts
    946
    Mayday is talking about you declaring the same function 3 times on a page. If you want three different functions then you need to name them 3 different things. What i was saying is if the function is going to perform the same action, but some variable changes like the string you want to pop up in the alert box then pass thing string through the functions parameters.

  13. #13
    Join Date
    Jan 2009
    Posts
    30

    www.practising.synthasite.com

    Click on a should show "a dog", on b "a cat" and on c "a mouse". But all show "A mouse."
    What is identifier in this situation?
    Please help someone!
    Thanks in advance!
    M

  14. #14
    Join Date
    Jan 2009
    Posts
    30

    :eek:!!!



    Many thanks, Skywalker, but how to do that? I tried to strt each with <html><body> and finnish that way but did nto work ( well I dont know, just dont know where to find out!!!)

  15. #15
    Join Date
    Jan 2009
    Posts
    30
    <script type="text/javascript">
    function myfunction(){alert("A dog");}
    </script>
    <form><input type="button" onclick="myfunction()" value="a)"></form>
    <br>
    <br>
    <script type="text/javascript">
    function myfunction(){alert("A cat ");}
    </script>
    <form><input type="button" onclick="myfunction()" value="b)"></form>
    <script type="text/javascript">
    function myfunction(){alert("A mouse");}
    </script>
    <form><input type="button" onclick="myfunction()" value="C"></form>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles