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.

Javascript again lol

View previous topic View next topic Go down

Javascript again lol

Post by LostLegend on June 21st 2010, 9:54 pm

I have a text box. On my forum. *points to profile*

This text box is a word count tool.
It is located on the bottom-left of the forum, as a widget.

The colour of the typed text is white.
The background colour of the box is white.
Alas, you cannot see the text.

How can I make the text, let's say... Orange, when I type in that box?

Here's the code...

Code:
<form method="POST" name="wordcount">
  <script language="JavaScript">

function countit(){

<center>

<SCRIPT LANGUAGE="javascript">
document.write

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="50%"><textarea rows="12" name="wordcount2" cols="24" wrap="virtual"></textarea></td>
    </tr>
    <tr>
      <td width="50%"><div align="right"><p><input type="button" value="Calculate Words"
      onClick="countit()"> <input type="text" name="wordcount3" size="20"></p>
      </center></div></div></td>

</FONT>
</SCRIPT>
    </tr>
  </table>
</form>

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 21st 2010, 11:13 pm

Here yo go :
<html>
<body>
<script language="JavaScript" type="text/javascript">
<!--
function changeTextColor(textcolor){
document.getElementById("fontColor").style.color = textcolor.value;

}
//-->
</script>
</body>
</html>

<form method="POST" name="wordcount">
<script language="Javascript">

function countit(){

<center>

<script LANGUAGE="javascript">
document.write

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><textarea rows="12" name="wordcount2" cols="24" wrap="virtual" id="fontColor" style="color:orange;" onchange="changeTextColor(this);"></textarea></td>
</tr>
<tr>
<td width="50%"><div align="right"><p><input type="button" value="Calculate Words"
onClick="countit()" > <input type="text" name="wordcount3" size="20" id="fontColor" style="color:orange;" onchange="changeTextColor(this);"></p>
</center></div></div></td>

</FONT>
</script>
</tr>
</table>
</form>

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 21st 2010, 11:31 pm

Wow, that's a lot of code! Thank you so much!

Edit: For future reference, how do you change the colour of the text box itself? (Using black as an example if it retains a white outline!

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 22nd 2010, 10:33 am

What is future reference x'D lol?

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 22nd 2010, 5:13 pm

Future reference so I'll know how to change colours of text (which I now do) and background colour (which I don't know)

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 22nd 2010, 5:19 pm

Code:

id="fontColor" style="color:[color=orange]orange[/color];" onchange="changeTextColor(this);"
in this code you can change the color.

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 22nd 2010, 6:13 pm

Actually I was looking for background colour 0.o

Never mind, someone messaged me and I have it now. Thanks anyway.

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 22nd 2010, 6:13 pm

Lol Ok xD NP

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 22nd 2010, 6:16 pm

Urh. The script broke and now it won't calculate words.
Nothing happens after typing and pressing "calculate words"

Code:
<html>
<body>
<script language="Javascript" type="text/javascript">
<!--
function changeTextColor(textcolor){
document.getElementById("fontColor").style.color = textcolor.value;

}
//-->
</script>
</body>
</html>

<form method="POST" name="wordcount">
<script language="Javascript">

function countit(){

<center>

<script LANGUAGE="javascript">
document.write

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%">
<textarea rows="12" name="wordcount2" cols="24" wrap="virtual" id="fontColor" style="color:orange; background-color:black; border:white 2px solid" onchange="changeTextColor(this);"></textarea></td>
</tr>
<tr>
<td width="50%"><div align="right">
<p>
<input type="button" value="Calculate Words"
onClick="countit()" >

<input type="text" name="wordcount3" size="20" id="fontColor" style="color:orange; background-color:black; border:white 2px solid" onchange="changeTextColor(this);">

</p></center></div></div></td>

</FONT>
</script>
</tr>
</table>
</form>

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 22nd 2010, 6:43 pm

was it working? xD

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 22nd 2010, 7:17 pm

Yes, it worked before.
Now it doesn't.

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 22nd 2010, 7:22 pm

Orh Okay Sad

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 22nd 2010, 7:56 pm

I think the coding may have messed up the number generator or it got edited somehow.

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by boffer10 on June 22nd 2010, 9:18 pm

It didn't work yesterday when it was first posted. I wondered if all the code had been copied/pasted.

boffer10
Forumember

Male Posts : 311
Reputation : 10
Language : english
Location : Go Seahawks!

http://squarefoot.creatingforum.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 22nd 2010, 9:20 pm

at me too there is some thing missing

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 22nd 2010, 11:34 pm

Boffer, that is strange. It worked for me. Yes, I did copy and paste it all.
Can anyone identify the missing segment?

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 22nd 2010, 11:55 pm

where did you copied it from?

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 23rd 2010, 12:10 am

Javascript website which it worked on.
I saw it when an affilated person ha word count and below it was link to the site. I needed a word count so I followed link to site.

His word count worked

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 23rd 2010, 3:05 am

so give us the link and we try to make it works.

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 23rd 2010, 6:41 pm


LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 23rd 2010, 6:59 pm

How about this:
Code:

<body>
<script language="Javascript" type="text/javascript">
<!--
function changeTextColor(textcolor){
document.getElementById("fontColor").style.color = textcolor.value;

}
//-->
</script>
</body>

<form method="POST" name="wordcount">
  <script language="JavaScript">

function countit(){

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%"><textarea style="background: black" rows="12" name="wordcount2" id="fontColor" style="color:orange;" onchange="changeTextColor(this);  cols="60"  wrap="virtual"></textarea></td>
    </tr>
    <tr>
      <td width="100%"><div align="right"><p><input type="button" value="Calculate Words"
      onClick="countit()"> <input type="text" style="background: black" name="wordcount3" size="20"></p>
      </td>
    </tr>
  </table>
</form>

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 23rd 2010, 7:08 pm

Nothing happens.

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 23rd 2010, 7:09 pm

OMG it works for me but where you put it?

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by kieran1 on June 23rd 2010, 8:19 pm

Code:
<form method="POST" name="wordcount">
  <script language="JavaScript">

function countit(){

/*Word count script
By JavaScript Kit (http://javascriptkit.com)
Over 400+ free scripts here!
*/

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%"><textarea rows="12" name="wordcount2" cols="60" wrap="virtual"></textarea></td>
    </tr>
    <tr>
      <td width="100%"><div align="right"><p><input type="button" value="Calculate Words"
      onClick="countit()"> <input type="text" name="wordcount3" size="20"></p>
      <div align="center">
      </div></div></td>
    </tr>
  </table>
</form>

kieran1
Forumember

Male Posts : 69
Reputation : 0
Language : English
Location : USA

Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 23rd 2010, 8:24 pm

What is the above? And I put the one previously posted above other word count.
(There are 2 in 1 box now)

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 23rd 2010, 8:25 pm

@kieran1 wrote:
Code:
<form method="POST" name="wordcount">
  <script language="JavaScript">

function countit(){

/*Word count script
By JavaScript Kit (http://javascriptkit.com)
Over 400+ free scripts here!
*/

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%"><textarea rows="12" name="wordcount2" cols="60" wrap="virtual"></textarea></td>
    </tr>
    <tr>
      <td width="100%"><div align="right"><p><input type="button" value="Calculate Words"
      onClick="countit()"> <input type="text" name="wordcount3" size="20"></p>
      <div align="center">
      </div></div></td>
    </tr>
  </table>
</form>

That's the original code.

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 23rd 2010, 10:29 pm

I need original code with the background and border alteration as well as the colour of font >.<

Just, why isn't it working for me?!

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 27th 2010, 7:55 pm

Done some fiddling but the box still isn't working. I think the button for the script is broken.
The site link is in first post and the box is on the bottom-left of widgets. Type couple words in and press the button below the box. Nothing happens.

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.forumotion.com/

Back to top Go down

Re: Javascript again lol

Post by Guest on June 27th 2010, 8:26 pm

Its works for me, when i write one word and click calculate its show me 1 in the second field Wink

Guest
Guest


Back to top Go down

Re: Javascript again lol

Post by LostLegend on June 27th 2010, 8:32 pm

I try it on my ipod and my computer, it shows nothing on either?
Yet, I tried it on another site and it worked there.
Strange!

LostLegend
Forumember

Posts : 922
Reputation : 22
Language : English

http://naruto-role-play-rpg.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