/    Sign up×
Community /Pin to ProfileBookmark

What’s Wrong!

What is wrong with this script? It gives me an error! Any help is great!

[code=html] arr = new Array(
{keywords:”volkswagen, car, pimp my ride”,description:”<a href=’car.html’>Volkswagen Pimp My Ride</a>”},
{keywords:”badger, snake, funny, song”,description:”<a href=’badger.html’>Badger Badger Badger</a>”},
{keywords:”microsoft, msipod, ms, msft, mico, soft, funny”,description:”<a href=’ipod.html’>Micosoft iPod</a>”},
{keywords:”llama, funny, duck”,description:”<a href=’llama.html’>The Llama Song</a>”},
{keywords:”mentos, diet coke, reaction, mdc”,description:”<a href=’mdc.html’>The Mentos and Diet Coke Reaction</a>”},
{keywords:”breeze, around, privates, clean, muggle, pants”,description:”<a href=’mp.html’>Muggle Pants</a>”},
{keywords:”old, car, skateboard, horn, lady, people”,description:”<a href=’old.html’>The Power of Old People</a>”},
{keywords:”old, funny, do, for, people”,description:”<a href=’old_fun.html’>What Old People Do For Fun</a>”},
{keywords:”pie, hole, whole, fart, mouth, funny”,description:”<a href=’pie.html’>Pie Hole</a>”},
{keywords:”power tool, race, funny, tools”,description:”<a href=’power.html’>Power Tool Race</a>”},
{keywords:”spore, nintendo, wii, game, cool”,description:”<a href=’spore.html’>Spore For Nintendo Wii</a>”},
{keywords:”taters, mashed, potatoes, funny, wierd, weird”,description:”<a href=’taters.html’>Mashed Taters</a>”},
{keywords:”wii, nintendo, game, xbox, gamecube, gameboy, spore”,description:”<a href=’wii.html’>Nintendo Wii aka revolution</a>”},
{keywords:”cute, cat, puppies, dog, kitty, funny”,description:”<a href=’cat.html’>Puppies vs Cat</a>”},
{keywords:”simpsons, funny, the, homer, underwear, tv, july, 2007, 27″,description:”<a href=’simpsons.html’>The Simpsons Real vs cartoon</a>”},
{keywords:”funny, numa, dance, fat guy, cool”,description:”<a href=’numa.html’>The Numa Numa Dance</a>”},
{keywords:”pokemon, kids, metro, train, station, funny, lol”,description:”<a href=’poke.html’>Kid Sings Pokemon Theme</a>”},
{keywords:”funny, motorcycle, cool, ouch”,description:”<a href=’motor.html’>Motorcycle Ouchie</a>”},
{keywords:”car, SUV, rims, picture, funny, cool”,description:”<a href=’rim.html’>Picture Rims</a>”},
{keywords:”simpsons, homer, matt, superman”,description:”<a href=’simpmovie.html’>The Simpsons Movie</a>”},
{keywords:”type, alphabet, letters, seconds, keyboard”,description:”<a href=’type.html’>Fast Typing</a>”}
)
function hi(keyword){
var desc = “”;
for(var i = 0; i < arr.length; i++){
var keywords = arr[i].keywords.split(“,”);
for(var j = 0; j < keywords.length; j++){
if(keywords[j].indexOf(keyword) > -1)
desc += arr[i].description + “<br>”;
}
}
document.getElementById(“description”).innerHTML = desc;
}
if(keywords[j].indexOf(keyword) > -1)[/code]

P.S. Don’t ask about the beginning of the script. Go to [url]www.davidlemcoe.com[/url] to figure it out.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51May 31.2006 — Why don't you figure it out. Get Firefox, look at the JavaScript console. It will point your toward your error.

In the future when you post say what the error is, not just solve my problem!

Eric
Copy linkTweet thisAlerts:
@AltF4authorMay 31.2006 — Well I hate firefox, but I got it to see cross-browser things, and I downloaded the FireBug Plugin. I tried it and this line is what causes it.

if(keywords[j].indexOf(keyword) > -1)
×

Success!

Help @AltF4 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...