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
Show the code you have.
Patience, we are giving of our free time to help others.
At least 98% of internet users' DNA is identical to that of chimpanzees
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>
You need to use unique identifiers for your functions
Originally Posted by
marija
</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>
"Why must I be surrounded by frikkin' idiots?!" - Dr. Evil
"Remember: There are no stupid questions, only stupid people." - Mr. Garrison
Originally Posted by
Mayday
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.
Or you could do that. Replace where I orinignally said "need to" with "could".
"Why must I be surrounded by frikkin' idiots?!" - Dr. Evil
"Remember: There are no stupid questions, only stupid people." - Mr. Garrison
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!)
Originally Posted by
marija
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.
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
Please, what is identifier?
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.
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
: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!!!)
<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
Forum Rules
Bookmarks