The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Widget Javascript codes keep interracting

View previous topic View next topic Go down

Solved Widget Javascript codes keep interracting

Post by Ravenstar on September 29th 2012, 1:06 am

Im making Javascript and HTML coding within one widget, however, diffrent parts of coding are interracting with each other, im making buttons that change the words above them, but the buttons are making the wrong words change and into the wrong new statement.....
then i tried putting them in seperate widgets, but they STILL interracted with each other on the homepage...



this is the code im using for the first button:
Code:

<span style="font-size: 10px; line-height: normal">
<head>
<script>
function myFunction()
{
document.getElementById("a").innerHTML="AWCA: Willowstorm,Ravenstar,<br>Oceanstorm,Hazelflower,<br>Spottedleaf,Dovewing,<br>Petalpelt,Eaglestar";
}
</script>
</head>




<p id="a">The AWCA is an Amazing group of Warrior RP forums, AWCA(awesome warrior cats aliance) is a forum cluster</p>

<button type="button" onclick="myFunction()">AWCA leaders</button>
</script>

here is the code for the second one,
Code:

<span style="font-size: 10px; line-height: normal">
<head>
<script>
function myFunction()
{
document.getElementById("staff").innerHTML="Willowstorm,Ravenstar,<br>Oceanstorm,Hazelflower,<br>Spottedleaf,Dovewing,<br>Petalpelt,Eaglestar";
}
</script>
</head>



<p id="staff">Warriorclan staff are<br> Always about, and ready to help!</p>

<button type="button" onclick="myFunction()">Staff list</button>
</script>

but they keep interracting with each other, and also, i want to combine them into one widget, ive tried to do this, but its still the same problem occuring
please help me


Last edited by Ravenstar on September 30th 2012, 7:52 am; edited 1 time in total

Ravenstar
Forumember

Male Posts : 54
Reputation : 2
Language : English|Javascript|HTML|Lua|
Location : :3 somwhere!

http://warriorclan.forumotion.com/

Back to top Go down

Solved Re: Widget Javascript codes keep interracting

Post by Ravenstar on September 30th 2012, 7:44 am

Ok, done, now what?

Ravenstar
Forumember

Male Posts : 54
Reputation : 2
Language : English|Javascript|HTML|Lua|
Location : :3 somwhere!

http://warriorclan.forumotion.com/

Back to top Go down

Solved Re: Widget Javascript codes keep interracting

Post by Ravenstar on September 30th 2012, 8:57 am

here is the forum link: http://warriorclan.forumotion.com/

now, go to the widgets on the right, and then look down untill you see the widgets with the buttons "AWCA" and "staff list:"
and if u click on them, they make the wrong thing happen.


thats the problem

Ravenstar
Forumember

Male Posts : 54
Reputation : 2
Language : English|Javascript|HTML|Lua|
Location : :3 somwhere!

http://warriorclan.forumotion.com/

Back to top Go down

Solved Re: Widget Javascript codes keep interracting

Post by nextlevelgaming on September 30th 2012, 9:35 am

myFunction needs to have two different names. myFunction and myFunction2

also you did not insert a use strict in your code.

Code:
function myFunction() {
"use strict";
document.getElementById("staff").innerHTML="Willowstorm,Ravenstar,<br>Oceanstorm,Hazelflower,<br>Spottedleaf,Dovewing,<br>Petalpelt,Eaglestar";
}
Code:
function myFunction2() {
"use strict";
document.getElementById...

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Solved Re: Widget Javascript codes keep interracting

Post by Ravenstar on September 30th 2012, 9:50 am

Never mind Everyone!
my father showed me how, i needed to change
the "Function myFunction()"
to "Function (ID word)Function"



u can toss this into the garbage or something now

Ravenstar
Forumember

Male Posts : 54
Reputation : 2
Language : English|Javascript|HTML|Lua|
Location : :3 somwhere!

http://warriorclan.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum