Home | Community | Message Board


This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Shop: Myyco.com Golden Teacher Liquid Culture For Sale   Original Sensible Seeds Bulk Cannabis Seeds   Sporeworks.EU Spores for European Microscopy   North Spore North Spore Mushroom Grow Kits & Cultivation Supplies   MagicBag.co Certified Organic All-In-One Grow Bags

Jump to first unread post Pages: 1
super simple java help needed please
    #7918462 -

Hey folks, I was just wondering if someone could help me out with this java code.

My friend asked me to write her a simple HTML code, and I (stupidly) said yes. Turns out, what she actually needs is a javascript code and I know next to nothing about javascript. So this is what I've got so far. It doesn't do anything. How can I fix it?

I made a quick site to show off how much it doesn't work, so you can view source on the link. Sorry about all the bullshit ads, angelfire had the quickest signup.

http://angelfire.com/vas3lin3.html


--------------------
"The important thing to remember: if we ship all our fat-bottomed girls off to foreign countries, the terrorists win."

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: mayfly]
    #7918550 -

what do you want it to do?


--------------------
"Where?

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: SmokenBabyJesus]
    #7919546 -

Apparently I was more tired than I thought when I wrote this.

I need it to generate random phrases from 3 lists of words. (Array 1, 2, & 3). When you press the 'generate' button, a random phrase from the lists should appear in the box.

Here's a site with a similar concept that actually works.
http://dack.com/web/bullshit.html


--------------------
"The important thing to remember: if we ship all our fat-bottomed girls off to foreign countries, the terrorists win."

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: mayfly]
    #7919679 -

use their code:

Code:
<SCRIPT LANGUAGE="JAVASCRIPT">

var max1 = 59;
var max2 = 64;
var max3 = 43;

index1 = Math.round(Math.random() * max1);
index2 = Math.round(Math.random() * max2);
index3 = Math.round(Math.random() * max3);

array1 = new Array("implement", "utilize", "integrate", "streamline", "optimize", "evolve", "transform", "embrace",
"enable", "orchestrate", "leverage", "reinvent", "aggregate", "architect", "enhance", "incentivize", "morph", "empower",
"envisioneer", "monetize", "harness", "facilitate", "seize", "disintermediate", "synergize", "strategize", "deploy",
"brand", "grow", "target", "syndicate", "synthesize", "deliver", "mesh", "incubate", "engage", "maximize", "benchmark",
"expedite", "reintermediate", "whiteboard", "visualize", "repurpose", "innovate", "scale", "unleash", "drive", "extend",
"engineer", "revolutionize", "generate", "exploit", "transition", "e-enable", "iterate", "cultivate", "matrix",
"productize", "redefine",
"recontextualize");

array2 = new Array("clicks-and-mortar", "value-added", "vertical", "proactive", "robust", "revolutionary", "scalable",
"leading-edge", "innovative", "intuitive", "strategic", "e-business", "mission-critical", "sticky", "one-to-one",
"24/7", "end-to-end", "global", "B2B", "B2C", "granular", "frictionless", "virtual", "viral", "dynamic", "24/365",
"best-of-breed", "killer", "magnetic", "bleeding-edge", "web-enabled", "interactive", "dot-com", "sexy", "back-end",
"real-time", "efficient", "front-end", "distributed", "seamless", "extensible", "turn-key", "world-class",
"open-source", "cross-platform", "cross-media", "synergistic", "bricks-and-clicks", "out-of-the-box", "enterprise",
"integrated", "impactful", "wireless", "transparent", "next-generation", "cutting-edge", "user-centric", "visionary",
"customized", "ubiquitous", "plug-and-play", "collaborative", "compelling", "holistic", "rich");

array3 = new Array("synergies", "web-readiness", "paradigms", "markets", "partnerships", "infrastructures", "platforms",
"initiatives", "channels", "eyeballs", "communities", "ROI", "solutions", "e-tailers", "e-services", "action-items",
"portals", "niches", "technologies", "content", "vortals", "supply-chains", "convergence", "relationships",
"architectures", "interfaces", "e-markets", "e-commerce", "systems", "bandwidth", "infomediaries", "models",
"mindshare", "deliverables", "users", "schemas", "networks", "applications", "metrics", "e-business", "functionalities",
"experiences", "web services", "methodologies");

function getResult()
{
index1 = Math.round(Math.random() * max1);
index2 = Math.round(Math.random() * max2);
index3 = Math.round(Math.random() * max3);

document.frmTest.txtTest.value = array1[index1] + " " + array2[index2] + " " + array3[index3];

}
</SCRIPT>
<FORM NAME="frmTest" onsubmit="return false">
<INPUT TYPE="TEXT" NAME="txtTest" SIZE="50"><BR>
<INPUT TYPE="BUTTON" VALUE="make bullshit" onClick="getResult();">
</FORM>


Extras: Filter Print Post Top
Re: super simple java help needed please [Re: mayfly]
    #7919701 -

Your link is broken but I'd probably do something like this:

Code:
<script type="text/javascript">
function generatePhrase(){
var output = '', wordlist = new Array();
wordlist[0] = ['up', 'down', 'left', 'right'];
wordlist[1] = ['red', 'green', 'blue', 'purple'];
wordlist[2] = ['circle', 'square', 'triangle', 'rectangle'];
for (var i=0; i<wordlist.length; i++){
output += (output ? ' ' : '') + wordlist[i][Math.floor(Math.random() * wordlist[i].length)];
}
document.getElementById('phrasebox').value = output;
}
</script>

<input type="text" id="phrasebox" name="phrasebox">
<input type="button" onclick="generatePhrase()" value="New Phrase">



Edit: Damn Annom beat me to it, but my code is more elegant. :grin:

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: Annom]
    #7919714 -

I rewrote the script so that you don't have to count and insert the number of elements/words in the array:

Code:
<SCRIPT LANGUAGE="JAVASCRIPT">

array1 = new Array("word1", "word2", "etc");
array2 = new Array("word1", "word2", "etc");
array3 = new Array("word1", "word2", "etc");

index1 = Math.round(Math.random() * array1.length);
index2 = Math.round(Math.random() * array2.length);
index3 = Math.round(Math.random() * array3.length);

function getResult()
{
index1 = Math.round(Math.random() * array1.length);
index2 = Math.round(Math.random() * array2.length);
index3 = Math.round(Math.random() * array3.length);

document.frmTest.txtTest.value = array1[index1] + " " + array2[index2] + " " + array3[index3];
}
</SCRIPT>
<FORM NAME="frmTest" onsubmit="return false">
<INPUT TYPE="TEXT" NAME="txtTest" SIZE="50"><BR>
<INPUT TYPE="BUTTON" VALUE="make bullshit" onClick="getResult();">
</FORM>


Extras: Filter Print Post Top
Re: super simple java help needed please [Re: Ythan]
    #7919743 -

Ythans script is nicer because it has a loop :smile: It's not code if it doesn't have a loop! :wink:

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: Ythan]
    #7919752 -

Thanks, but I'm still not quite following... Like I said, I know pretty much nothing about java. :confused:

http://www.angelfire.com/vas3lin3/index.html


--------------------
"The important thing to remember: if we ship all our fat-bottomed girls off to foreign countries, the terrorists win."

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: mayfly]
    #7919768 -

Use my new code or Ythans code. That should work!

The code you use now doesn't work because you manually have to set the number of words in the array and you didn't change that.

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: mayfly]
    #7919775 -

Well Java isn't the same as JavaScript, so don't get them confused or it could lead to much frustration when searching for solutions online. The code works as is, I just tested it. Copy and paste into a new HTML document and view in a web browser. You'll have to be more specific about what you need help with though.

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: Ythan]
    #7919801 -

AH okay, thanks. Sorry to be confusing.


--------------------
"The important thing to remember: if we ship all our fat-bottomed girls off to foreign countries, the terrorists win."

Extras: Filter Print Post Top
Re: super simple java help needed please [Re: mayfly]
    #7919804 -

Does it work now?

Extras: Filter Print Post Top
Jump to top Pages: 1

Shop: Myyco.com Golden Teacher Liquid Culture For Sale   Original Sensible Seeds Bulk Cannabis Seeds   Sporeworks.EU Spores for European Microscopy   North Spore North Spore Mushroom Grow Kits & Cultivation Supplies   MagicBag.co Certified Organic All-In-One Grow Bags


Similar ThreadsPosterViewsRepliesLast post
* Java Virtual Engine? ImOver18 994 6 04/13/04 06:35 PM
by MAIA
* removing Java Runtime Environment, SE v1.4.2_05 felix 942 6 08/31/05 11:16 PM
by Vvellum
* new to html/java etc... funkymonk 617 4 08/13/03 11:27 PM
by funkymonk
* . z_x_x_z 652 2 03/19/05 11:51 PM
by kronnyQ
* I need a way to hide folders Chemical_Smile 2,678 19 08/16/02 04:53 PM
by tps
* Fuck, I need help with proxy. Chemical_Smile 1,105 4 07/22/02 12:25 AM
by downforpot
* I need help building a PC Rainbow 1,420 8 05/21/09 07:50 AM
by dopelogic
* another simple(?) PC question lol ChromeCrow 1,070 7 11/12/03 11:33 PM
by mntlfngrs

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: trendal, automan, Northerner
978 topic views. 0 members, 26 guests and 5 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2026 Mind Media. Some rights reserved.

Generated in 0.029 seconds spending 0.005 seconds on 14 queries.