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   Bridgetown Botanicals Bridgetown Botanicals   MagicBag.co Certified Organic All-In-One Grow Bags   Original Sensible Seeds Bulk Cannabis Seeds   North Spore North Spore Mushroom Grow Kits & Cultivation Supplies

Jump to first unread post Pages: 1
Invisiblemayfly
.
Female


Registered: 01/05/08
Posts: 800
Loc: planet home
super simple java help needed please
    #7918462 - 01/23/08 01:45 AM (16 years, 2 months ago)

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
InvisibleSmokenBabyJesus
Smoker of Religious Figures


Registered: 04/13/05
Posts: 1,217
Loc: Maryland
Re: super simple java help needed please [Re: mayfly]
    #7918550 - 01/23/08 02:32 AM (16 years, 2 months ago)

what do you want it to do?


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

Extras: Filter Print Post Top
Invisiblemayfly
.
Female


Registered: 01/05/08
Posts: 800
Loc: planet home
Re: super simple java help needed please [Re: SmokenBabyJesus]
    #7919546 - 01/23/08 11:51 AM (16 years, 2 months ago)

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
OfflineAnnom
※※※※※※
 User Gallery


Folding@home Statistics
Registered: 12/22/02
Posts: 6,367
Loc: Europe
Last seen: 10 months, 7 days
Re: super simple java help needed please [Re: mayfly]
    #7919679 - 01/23/08 12:31 PM (16 years, 2 months ago)

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
OfflineYthanA
ᕕ( ᐛ )ᕗ
Male User Gallery


Registered: 08/08/97
Posts: 18,817
Loc: NY/MA/VT Borderlands Flag
Last seen: 14 hours, 35 minutes
Re: super simple java help needed please [Re: mayfly]
    #7919701 - 01/23/08 12:38 PM (16 years, 2 months ago)

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
OfflineAnnom
※※※※※※
 User Gallery


Folding@home Statistics
Registered: 12/22/02
Posts: 6,367
Loc: Europe
Last seen: 10 months, 7 days
Re: super simple java help needed please [Re: Annom]
    #7919714 - 01/23/08 12:42 PM (16 years, 2 months ago)

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
OfflineAnnom
※※※※※※
 User Gallery


Folding@home Statistics
Registered: 12/22/02
Posts: 6,367
Loc: Europe
Last seen: 10 months, 7 days
Re: super simple java help needed please [Re: Ythan]
    #7919743 - 01/23/08 12:46 PM (16 years, 2 months ago)

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
Invisiblemayfly
.
Female


Registered: 01/05/08
Posts: 800
Loc: planet home
Re: super simple java help needed please [Re: Ythan]
    #7919752 - 01/23/08 12:48 PM (16 years, 2 months ago)

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
OfflineAnnom
※※※※※※
 User Gallery


Folding@home Statistics
Registered: 12/22/02
Posts: 6,367
Loc: Europe
Last seen: 10 months, 7 days
Re: super simple java help needed please [Re: mayfly]
    #7919768 - 01/23/08 12:52 PM (16 years, 2 months ago)

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
OfflineYthanA
ᕕ( ᐛ )ᕗ
Male User Gallery


Registered: 08/08/97
Posts: 18,817
Loc: NY/MA/VT Borderlands Flag
Last seen: 14 hours, 35 minutes
Re: super simple java help needed please [Re: mayfly]
    #7919775 - 01/23/08 12:54 PM (16 years, 2 months ago)

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
Invisiblemayfly
.
Female


Registered: 01/05/08
Posts: 800
Loc: planet home
Re: super simple java help needed please [Re: Ythan]
    #7919801 - 01/23/08 01:01 PM (16 years, 2 months ago)

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
OfflineAnnom
※※※※※※
 User Gallery


Folding@home Statistics
Registered: 12/22/02
Posts: 6,367
Loc: Europe
Last seen: 10 months, 7 days
Re: super simple java help needed please [Re: mayfly]
    #7919804 - 01/23/08 01:02 PM (16 years, 2 months ago)

Does it work now?

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

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


Similar ThreadsPosterViewsRepliesLast post
* Java Virtual Engine? ImOver18 943 6 04/13/04 06:35 PM
by MAIA
* removing Java Runtime Environment, SE v1.4.2_05 felix 932 6 08/31/05 11:16 PM
by Vvellum
* new to html/java etc... funkymonk 586 4 08/13/03 11:27 PM
by funkymonk
* . dr_gonz 621 2 03/19/05 11:51 PM
by kronnyQ
* I need a way to hide folders Chemical_Smile 2,584 19 08/16/02 04:53 PM
by tps
* Fuck, I need help with proxy. Chemical_Smile 1,084 4 07/22/02 12:25 AM
by downforpot
* I need help building a PC Rainbow 1,334 8 05/21/09 07:50 AM
by dopelogic
* another simple(?) PC question lol ChromeCrow 1,053 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
937 topic views. 0 members, 2 guests and 4 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.027 seconds spending 0.007 seconds on 14 queries.