The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Javascript again lol

3 posters

Go down

Javascript again lol Empty Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by Guest 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>
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

What is future reference x'D lol?
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by Guest 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.
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

Lol Ok xD NP
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

was it working? xD
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

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

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

Orh Okay Sad
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

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

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by boffer10 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.
avatar
boffer10
Forumember

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

http://squarefoot.creatingforum.com/

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

at me too there is some thing missing
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

where did you copied it from?
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

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


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

LostLegend
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by Guest 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>
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

Nothing happens.
LostLegend
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

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

OMG it works for me but where you put it?
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by kieran1 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
kieran1
Forumember

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by Guest 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.
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by Guest 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
avatar
Guest
Guest


Back to top Go down

Javascript again lol Empty Re: Javascript again lol

Post by LostLegend 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
LostLegend
Forumember

Posts : 922
Reputation : 23
Language : English

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

Back to top Go down

Back to top

- Similar topics

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