Log in

View Full Version : VS Express 2012 Javascript help?



CrazyColaist
08-12-2012, 01:14 AM
hi there mateys, im making an app for windows 8 atm and im just abit confused as for the javascript.

http://tinypic.com/r/a8ej6/6


right you see there where ive put 111 222 etc etc, well i want different sentences for each of the groups.(one set of info for haze another for jack herrer) but for every single group it is using this bit of javascript for all. when i want one for each one,


+rep if someone can give me a solution


function generateSampleData() {
var itemContent = "<p>what does this change 1111 </p><p>What does this change 222</p><p>And this one 333</p><p>Helloo 5555</p><p>and this bit 77777</p>";
var itemDescription = "Item Description: Pellentesque porta mauris quis interdum vehicula urna sapien ultrices velit nec venenatis dui odio in augue cras posuere enim a cursus convallis neque turpis malesuada erat ut adipiscing neque tortor ac erat";
var groupDescription = "N/A";

// Each of these sample groups must have a unique key to be displayed
// separately.
var sampleGroups = [
{ key: "group1", title: "Sativa", subtitle: "Haze,Jack Herrer", backgroundImage: darkGray, description: groupDescription },
{ key: "group2", title: "Indica", subtitle: "Blue Cheese,Strawberry Kush", backgroundImage: lightGray, description: groupDescription },
{ key: "group3", title: "Hybrids", subtitle: "White Widow,Purple Kush", backgroundImage: mediumGray, description: groupDescription },
{ key: "group4", title: "Other", subtitle: "Pot Smoking acessories Etc", backgroundImage: lightGray, description: groupDescription },
{ key: "group5", title: "Legalise it!", subtitle: "Public support", backgroundImage: mediumGray, description: groupDescription },

];

// Each of these sample items should have a reference to a particular
// group.
var sampleItems = [
{ group: sampleGroups[0], title: "Haze", subtitle: "Common Skunk 18-20%thc", description: itemDescription, content: itemContent, backgroundImage: lightGray },
{ group: sampleGroups[0], title: "Jack Herrer", subtitle: "90% Sativa 15-20%thc", description: itemDescription, content: itemContent, backgroundImage: lightGray },
{ group: sampleGroups[0], title: "Ice", subtitle: "Item Subtitle: 3", description: itemDescription, content: itemContent, backgroundImage: mediumGray },
{ group: sampleGroups[0], title: "Silver Haze", subtitle: "Mostly Sativa high thc (18-22%)", description: itemDescription, content: itemContent, backgroundImage: darkGray },
{ group: sampleGroups[0], title: "AK47", subtitle: "Mostly Sativa 19% THC", description: itemDescription, content: itemContent, backgroundImage: mediumGray },

{ group: sampleGroups[1], title: "Blue Cheese", subtitle: "15-20% thc 80% Indica", description: itemDescription, content: itemContent, backgroundImage: darkGray },
{ group: sampleGroups[1], title: "Bubba Kush", subtitle: "High THC 20%+ Dominant Indica", description: itemDescription, content: itemContent, backgroundImage: mediumGray },
{ group: sampleGroups[1], title: "Mango", subtitle: "100% Indica THC Ranges 15%-18%thc", description: itemDescription, content: itemContent, backgroundImage: lightGray },
{ group: sampleGroups[1], title: "White Rhino", subtitle: "90% Indica Extremerly High THC", description: itemDescription, content: itemContent, backgroundImage: darkGray },
{ group: sampleGroups[1], title: "stawberry kush", subtitle: "Mainly indica THC Varies", description: itemDescription, content: itemContent, backgroundImage: darkGray },



{ group: sampleGroups[2], title: "White Widow", subtitle: "Item Subtitle: 1", description: itemDescription, content: itemContent, backgroundImage: mediumGray },
{ group: sampleGroups[2], title: "BubbleGum", subtitle: "Item Subtitle: 2", description: itemDescription, content: itemContent, backgroundImage: lightGray },
{ group: sampleGroups[2], title: "Blueberry", subtitle: "Item Subtitle: 3", description: itemDescription, content: itemContent, backgroundImage: darkGray },
{ group: sampleGroups[2], title: "Purple Kush", subtitle: "Item Subtitle: 4", description: itemDescription, content: itemContent, backgroundImage: lightGray },
{ group: sampleGroups[2], title: "Jack The Ripper", subtitle: "Item Subtitle: 5", description: itemDescription, content: itemContent, backgroundImage: mediumGray },
{ group: sampleGroups[2], title: "Northen Lights #5", subtitle: "Item Subtitle: 6", description: itemDescription, content: itemContent, backgroundImage: darkGray },
{ group: sampleGroups[2], title: "Sour Kush", subtitle: "Item Subtitle: 7", description: itemDescription, content: itemContent, backgroundImage: mediumGray },

{ group: sampleGroups[3], title: "Afgan", subtitle: "Cros Breed I-D", description: itemDescription, content: itemContent, backgroundImage: darkGray },
{ group: sampleGroups[3], title: "Orignal Northen Lights", subtitle: "Cross Breed I-D", description: itemDescription, content: itemContent, backgroundImage: lightGray },
{ group: sampleGroups[3], title: "Pot/Sticky black etc", subtitle: "Item Subtitle: 3", description: itemDescription, content: itemContent, backgroundImage: darkGray },
{ group: sampleGroups[3], title: "Bong", subtitle: "Take a hit from the bong", description: itemDescription, content: itemContent, backgroundImage: lightGray },
{ group: sampleGroups[3], title: "Pipe", subtitle: "Easy way to take a hit out and about", description: itemDescription, content: itemContent, backgroundImage: mediumGray },
{ group: sampleGroups[3], title: "Rizlers", subtitle: "Papers Mainly cellocouse", description: itemDescription, content: itemContent, backgroundImage: lightGray },

Tomm
08-12-2012, 01:23 AM
Your using the same variable, itemContent, for all the content properties so obviously it is going to display the same text for all the items. Just change the content property on the items to reflect the actual content you want for that item.

Want to hide these adverts? Register an account for free!