[help]html text generator

Posts 1–4 of 4 · Page 1 of 1
[help]html text generator
i have looked on the internet for awhile now but i can find out how to make a html text generator and when i say that i mean, there is a button and a textbox above the button and when u press that button some prewritten text comes up that i added to it. like so when u press the button it will say "hi" and when u press it again it will say "go away." and so on.

thanks in advance
Create a file named textgen.html

CHANGE ALL ********** TO ********** IF ITS THE <script langauge="********"> TAG
Put this in textgen.html:

Code:
<script language="**********">
<!--
var r_text = new Array ();
r_text[0] = "Hello";
r_text[1] = "Umad LOL?";
r_text[2] = "Trolololo";
r_text[3] = "Go Away";
r_text[4] = "I wish you were a punchbag";
r_text[5] = "Your Mine";
r_text[6] = "This script was created by NutriGrain!";
var i = Math.floor(7*Math.random())

document.write(r_text[i]);

//-->
</script>
Save it.

In a main page like index.html , look where you want this to be, and place this where you want it (IN THE <BODY> TAGS!!!):

Code:
<iframe id="iframe1" src="textgen.html" width="100%" height="300">
  <p>Your browser does not support iframes.</p>
</iframe>
Now in the <HEAD> tags of index.html put this:

Code:
<script type="text/**********">

function Reload () {
var f = document.getElementById('iframe1');
f.src = f.src;
}

</script>
So, here's example:

INDEX.HTML

Code:
<html>
<head>
<title>Index Fo Sho</title>
<script type="text/**********">

function Reload () {
var f = document.getElementById('iframe1');
f.src = f.src;
}
</head>

<body>
<iframe id="iframe1" src="textgen.html" width="100%" height="300">
  <p>Your browser does not support iframes.</p>
</iframe>
</body>
</html

</script>

TEXTGEN.HTML
:

Code:
<html>
<head>
</head>
<body>
<script language="**********">
<!--
var r_text = new Array ();
r_text[0] = "Hello";
r_text[1] = "Umad LOL?";
r_text[2] = "Trolololo";
r_text[3] = "Go Away";
r_text[4] = "I wish you were a punchbag";
r_text[5] = "Your Mine";
r_text[6] = "This script was created by NutriGrain!";
var i = Math.floor(7*Math.random())

document.write(r_text[i]);

//-->
</body>
</html>
</script>
change
Code:
r_text[0] = "Hello";
, the "Hello" part to what you want.

Thank button is there. Add me as a friend, need more help? See my signature.

Sorry, didn't test this, don't know if it'll work. (its off the top of my head / )
NutriGrain has the right idea but horrible code. If you want me to give you a proper example gimme your page and show me where you want what and I'll do it, I'm too lazy to make something generic right now.
Yes, sorry for that code. It's 9:30pm here, been studying all night :S
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?