buzzykerbox 0 Light Poster

Hi i'm doing a project for college using jquery, i'd like to dynamically update a section when a link button is clicked
without reloading the page, the content fades out and the new content fades in, but when i click on a link the content fades out but the new content doesn't fade in, any suggestions, is there a better way of doing this???

$(function() {

var newHash      = "",
    $mainContent = $("#main-content"),
    $pageWrap    = $("#page-wrap"),
    baseHeight   = 0,
    $el;

$pageWrap.height($pageWrap.height());
baseHeight = $pageWrap.height() -     $mainContent.height();    

$('#list_nav li a').click(function() {
    window.location.hash = $(this).attr("href");
    return false;
});

    $(window).bind('hashchange', function(){

    newHash = window.location.hash.substring(1);

    if (newHash) {
        $mainContent
            .find("#guts")
            .fadeOut(500, function() {
                $mainContent.hide().load(newHash + " #guts", function() {
                    $mainContent.fadeIn(500, function() {
                        $pageWrap.animate({
                            height: baseHeight + $mainContent.height() + "px"
                        });
                    });
                    $("nav a").removeClass("current");
                    $("nav a[href='"+newHash+"']").addClass("current");
                });
            });
    };

});

$(window).trigger('hashchange');

});

buzzykerbox 0 Light Poster

Hi, I'm new to asp.net, I'm creating a quiz, I have a set of questions that are stored in an array and they are stored in session state, when I load the first page of the quiz a question is randomly chosen with a set of answers. when I move forward a page and then back
I want the same question to be displayed but it keeps displaying a new question, I tried storing the outputted question in session and then loading it before, but it doesn't work any suggestions???

Thanks in advance

namespace Quiz
{
    public partial class page2 : System.Web.UI.Page
    {
        string question;
        string[] questions;
        string[] answers;
        string correctanswer;
        public Random rnd = new Random();

       

        protected void Page_Load(object sender, EventArgs e)
        {

            questions = (string[])Session["Questions"];
            int randNum = rnd.Next(questions.Length);
            question = questions[randNum];

           

            lblQ1.Text = question;


            answers = (string[])Session["answers1"];
            correctanswer = answers[1];
            for (int i = 0; i < answers.Length; i++)
            {

                rbAns1.Items[i].Text = answers[i];

           
            }
        }
      protected void Page_PreRender(object sender, EventArgs e)
       {


           if (Session["selectedValue1"] != null)
           {

               rbAns1.SelectedIndex = (int)Session["selectedValue1"];

           }
           if (Session["questionAsked"] != null)
           {

               question = Session["questionAsked"].ToString();
               lblQ1.Text = question;

           }
            
      
       }

        protected void rbAns1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Session["selectedValue1"] = rbAns1.SelectedIndex;
           
           
        }

        protected void btnPrevious_Click(object sender, EventArgs e)
        {

            Session["questionAsked"] = question;
            Response.Redirect("StartPage.aspx");
        }

        protected void btnNext_Click(object sender, EventArgs e)
        {

            Session["questionAsked"] = question;
            Response.Redirect("page3.aspx");
          
        }
buzzykerbox 0 Light Poster

Hi I would like to change the color of an external style sheet rule using .css method of jquery is this possible? and how would I go about it?

Thanks,

buzzykerbox 0 Light Poster

is it possible to change an external style sheet using the css method?

buzzykerbox 0 Light Poster

Hello again,I'm writing a blackjack game for class,it generates two random numbers that select from a switch statement that creates a string file name of a card e.g "AceDiamonds.gif", it than fills an array deck[] with these strings,I want to fill the array with the full deck of 52 cards,and not have any duplicates, how do I check the array for an existing element remove it and replace with another card not in the deck??
Here is the code,

<script>
var dealer_hand = new Array();
var player_hand = new Array();
var deck = [];
function cardToString(value,suit)
{
var cvalue="";
var csuit="";
switch(value)
	{
	case 1:
	cvalue = "Ace";
	break;
	case 2:
	cvalue = "Two";
	break;
	case 3:
	cvalue = "Three";
	break;
	case 4:
	cvalue = "Four";
	break;
	case 5:
	cvalue = "Five";
	break;
	case 6:
	cvalue = "Six";
	break;
	case 7:
	cvalue = "Seven";
	break;
	case 8:
	cvalue = "Eight";
	break;
	case 9:
	cvalue = "Nine";
	break;
	case 10:
	cvalue = "Ten";
	break;
	case 11:
	cvalue = "Jack";
	break;

	case 12:
	cvalue = "Queen";
	break;
	case 13:
	cvalue = "King";
	break;
	default:
    cvalue=null;
	break;
	}

switch(suit)
	{
	case 1:
	csuit="Clubs";
	break;	
	case 2:
	csuit="Hearts";
	break;	
	case 3:
	csuit="Diamonds";
	break;	
	case 4:
	csuit="Spades";
	break;	
    default:
	csuit=null;
	break;	
	}
if(value==null||suit==null)
  return"";
	
var myCard = cvalue +  csuit +".gif";
 
return myCard;
}//End of cardToString Function


function shuffle()
{
var i=0;
var j=0;

for( i=0;i<52;i++)
	{
	
	var num1 = Math.floor(Math.random()* 13)+1;
    var num2 = Math.floor(Math.random()* 4)+1;
    
    myCard = cardToString(num1,num2);
    
	deck[i]=myCard;
     
        
	}
deck.sort(); …
buzzykerbox 0 Light Poster

I'll look into that thanks

buzzykerbox 0 Light Poster

Hi I would like to change a css rule,with javascript this is what i have so far??

body{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	/* [disabled]line-height: 17px; */
	color: #ffffff;
	background: url(images/bg.jpg);

<script>

function changeStyle()
{

var mySheet = document.styleSheets[0].rules || document.styleSheets[0].cssRule;
for(var i=0; i<mySheet.length;i++)
{
if(mySheet[i].selectorText == "body")
targetRule = mySheet[i];
targetRule= "background:#000000";

}




</script>

}

Thanks in advance!

buzzykerbox 0 Light Poster

Hello,

I'm creating a blackjack game,and would like the function cardToString to return the file name of a card e.g "AceDiamonds.gif" and fill an array called deck,its only returning one card and not filling the array

thank you in advance

<script>
var dealer_hand = new Array();
var player_hand = new Array();
var deck = [52];
function cardToString(value,suit)
{


var cvalue="";
var csuit="";
switch(value)
	{
	case 1:
	cvalue = "Ace";
	break;
	case 2:
	cvalue = "Two";
	break;
	case 3:
	cvalue = "Three";
	break;
	case 4:
	cvalue = "Four";
	break;
	case 5:
	cvalue = "Five";
	break;
	case 6:
	cvalue = "Six";
	break;
	case 7:
	cvalue = "Seven";
	break;
	case 8:
	cvalue = "Eight";
	break;
	case 9:
	cvalue = "Nine";
	break;
	case 10:
	cvalue = "Ten";
	break;
	case 11:
	cvalue = "Jack";
	break;

	case 12:
	cvalue = "Queen";
	break;
	case 13:
	cvalue = "King";
	break;
	default:
    cvalue=null;
	break;
	}

switch(suit)
	{
	case 1:
	csuit="Clubs";
	break;	
	case 2:
	csuit="Hearts";
	break;	
	case 3:
	csuit="Diamonds";
	break;	
	case 4:
	csuit="Spades";
	break;	
    default:
	csuit=null;
	break;	
	}
if(value==null||suit==null)
  return"";
	
var myCard = cvalue +  csuit +".gif";
 
return myCard;
}//End of cardToString Function


function shuffle()
{


for(var i=0;i<deck.length;i++)
	{
	var num1 = Math.floor(Math.random()* 13)+1;
    var num2 = Math.floor(Math.random()* 4)+1;

    myCard = cardToString(num1,num2);
    deck[i] = myCard;
   
	}	
 alert(deck);
}
</script>
<input type=button value="Shuffle" onclick="shuffle()"/>
</body>

</html>
buzzykerbox 0 Light Poster

anyone??

buzzykerbox 0 Light Poster

Hi have to pass the values in the first five text box's to the second five text box's,nearly have it

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script>

function transfer()
{
var myArray = [];
var txtBoxs1 = 5;
var i=0;


for (i=0;i<txtBoxs1;i++)
		{		
		myArray[i] =(document.getElementById('num' + (i+1)).  		value);
		
		document.Form2.value('num5'+(i)) 
		= myArray[i]		
		}

//alert(myArray);
}



</script>
<form name="Form2">

<label>No1.</label>
<input type=text id="num1" maxlength="25"/>
<br/>
<br/>
<label>No2.</label>
<input type=text id="num2" maxlength="25"/>
<br/>
<br/>
<label>No3.</label>
<input type=text id="num3" maxlength="25"/>
<br/>
<br/>
<label>No4.</label>
<input type=text id="num4" maxlength="25"/>
<br/>
<br/>
<label>No5.</label>
<input type=text id="num5" maxlength="25"/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<label>No6.</label>
<input type=text id="num6" maxlength="25"/>
<br/>
<br/>
<label>No7.</label>
<input type=text id="num7" maxlength="25"/>
<br/>
<br/>
<label>No8.</label>
<input type=text id="num8" maxlength="25"/>
<br/>
<br/>
<label>No9.</label>
<input type=text id="num9" maxlength="25"/>
<br/>
<br/>
<label>No10.</label>
<input type=text id="num10" maxlength="25"/>
<input type=button value="Transfer" onclick="transfer()"/>

<br/>
<br/>
</form>





</body>
</html>
buzzykerbox 0 Light Poster

Hi,

currently making a game for school and need some help,the game is a shorter version of blackjack, the card values are in an array, and they are 1 to 11,the dealer and the player get dealt two cards each at the start and then a third later, you can only use each card value four times and thats where i'm stuck,how do i keep count of which cards are used already.

Dim deck() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
    Dim num As Integer
    Dim num2 As Integer
    Dim num3 As Integer
    Dim num4 As Integer
    Dim num5 As Integer
    Dim num6 As Integer
    Dim dh As Integer
    Dim dh2 As Integer
    Dim dh3 As Integer
    Dim ph As Integer
    Dim ph2 As Integer
    Dim ph3 As Integer
    Dim ptotal As Integer
    Dim dtotal As Integer
    Dim dealscore As Integer = 0
    Dim playscore As Integer = 0

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Randomize()
        btndeal.Enabled = False
        btnExit.Enabled = False


        num = (Int(Rnd() * 10) + 1)
        num2 = (Int(Rnd() * 10) + 1)
        num3 = (Int(Rnd() * 10) + 1)
        num4 = (Int(Rnd() * 10) + 1)

        ph = deck(num)
        ph2 = deck(num2)
        dh = deck(num3)
        dh2 = deck(num4)

        ptotal = ph + ph2
        dtotal = dh + dh2



        txtDealer.Text = dtotal
        txtPlayer.Text = ptotal

        If (dtotal = 21) Then
            Label3.Text = "Dealer wins"

        ElseIf (ptotal = 21) Then
            Label3.Text = "Player …
buzzykerbox 0 Light Poster

The program is a modified game of black jack,where the program deals 2 cards to the dealer and the player,i was thinking of doing an array with the value of the cards which are 1 to 11 stored in 1 array and when it randomly picks the elements of the array it stores the indices used in another array,but still having problems???

buzzykerbox 0 Light Poster

Hey Guys and Gals,

I'm stuck on a little project im doing myself at home,I need to randomly pick an element from an array and I can only use that element three times,I can randomly pick the element but how do I go about only using it three times,if any one can point me in the right direction please

thanks

buzzykerbox 0 Light Poster

Thank you it works now,it just doesnt change the first 'X' even if the letter is correct???

buzzykerbox 0 Light Poster

Hey,have been having a problem with this code,dont no what to do here,trying to find the letter in the secret word in hangman.when the user inputs their choice how do i compare it with the secret word.was using a for loop but not sure

cout<<"\n\t\t    *********** H A N G M A N ***********\n\n";
          cout<<"\n\t\t      Welcome to To the game of Hangman  \n\n";
          cout<<"\n\t\t     Guess the letters of the random word \n\n";
    
          
          srand((unsigned)time(NULL));
          num = rand() % 9 + 0; 
          
          word_to_guess = words[num];
          strsize = word_to_guess.size();
          lives  = word_to_guess.size();
          lives = lives + 2;
          
          cout<<"Guess the secret word it has "<<strsize 
              <<" letters and you guess one letter at a time "<<endl<<endl;
          
          wordguessed = word_to_guess;
          
          for(int i = 0; i<word_to_guess.size();i++)
                  {
                      word_to_guess[i] = 'X';
                     
                  }
                   cout<<word_to_guess<<endl<<endl;
                  
                   
          while (lives>0 && wordguessed!=word_to_guess)
          {
               cout<<"You have "<<lives<<" guesses left"<<endl<<endl;
               cout<<"Please enter your guess"<<endl<<endl;
               cin>>guess;                         
               lives = lives -1;
               lettersguessed = lettersguessed + guess;   
               
               for(int h =0;h<word_to_guess.size();h++)
               {
                       word_to_guess[h]== guess;
                       }
buzzykerbox 0 Light Poster

Thanks,I had something like that a while ago but i must have made a mistake in my code,thanks again

buzzykerbox 0 Light Poster

Sorry thats not all the code,i have a string array with 10 words,the program randomly picks one of these words,it then converts the letters in the word to 'X',the user is asked to input a letter. I would like to know how to find that letter in the secret word

buzzykerbox 0 Light Poster

This is an assignment for class,design a hangman program,I convert the letters of the random word to charchters,when the user inputs there letter how do I compare that with the secret word, and display it,any suggestions????

for(int i = 0; i<word_to_guess.size();i++)
                  {
                      word_to_guess[i] = 'X';
                     
                  }
                   cout<<word_to_guess<<endl<<endl;
                  
                   
          while (lives>0 && wordguessed!=word_to_guess)
          {
               cout<<"You have "<<lives<<" guesses left"<<endl<<endl;
               cout<<"Please enter your guess"<<endl<<endl;
               cin>>guess;                         
               lives = lives -1;
               lettersguessed = lettersguessed + guess;
          
               solution = word_to_guess.find(guess)
                           
               
               
                                               
               cout<<"Your letters "<<lettersguessed<<endl<<endl;
buzzykerbox 0 Light Poster

Thanks guys

buzzykerbox 0 Light Poster

Trying to find the string length,of word_to_guess,wont work,any suggestions???

#include <iostream>
#include <cstdlib>
#include <string>


using namespace std;

int main()


{
    int num;
    int size;
    int num_guess;
    string word_to_guess; 
    string words [10] = {"john","paul", etc}
    char exit = 'y';
    char guess;
    
    
          srand((unsigned)time(NULL));
          num = rand() % 9 + 0;
          
       
          
          word_to_guess = words[num];
          size = strlen(word_to_guess);
buzzykerbox 0 Light Poster

Hi again, I can generate the random number but how do i compare this with the array index????

buzzykerbox 0 Light Poster

So basically i must use the rand function to pick a number between 0 and 9 and remove the element with that index and store it in another variable

buzzykerbox 0 Light Poster

Hey gang,

I have a string array containing 10 words,I would like to randomly pick one of these words, how do I go about it,cant find any tutorials????

Thanks Buzz

buzzykerbox 0 Light Poster

Thanks that worked fine,I'am still having a problem with the font,

Private Sub TimesNewRomantoolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimesNewRomanToolStripMenuItem.Click
        Me.Font = New System.Drawing.Font("Times New Roman")



    End Sub

it says font cannot be used as an expression??

buzzykerbox 0 Light Poster

Trying to validate the input of the textbox,when i enter a a number it displays the message box aswell

'Converting String TextBox to Integer
        guess = Convert.ToInt32(txtGuess.Text)


        If Not IsNumeric(txtGuess.Text) Or Val(txtGuess.Text) Then
            MessageBox.Show("Invalid Input")
        End If
buzzykerbox 0 Light Poster

Code for changing font through menu selection like "Arial"????

buzzykerbox 0 Light Poster

Just got it,that should be it for now.......hopefully ,thanks for your help

buzzykerbox 0 Light Poster

Thanks it's working fine now,just have a another problem,i have a splash screen and login form but when i login the main form doesnt show,do i have to code the main form???

buzzykerbox 0 Light Poster

Changed the code,every time it generates 0 as the random number??

Public Class frmMain
    Dim random_number As Integer
    Dim guess As Integer
    

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click
        

        guess = Convert.ToInt32(txtGuess.Text)

        If guess > random_number Then
            txtHint.Text = "too high"
        ElseIf guess < random_number Then
            txtHint.Text = "too low"
        End If

        If guess = random_number Then
            txtHint.Text = "correct"
        End If


    End Sub

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim random_number As Integer
        Randomize()
        random_number = Int(20 * Rnd()) + 1
buzzykerbox 0 Light Poster

Thanks for that ken,

buzzy

buzzykerbox 0 Light Poster

Hey,just have a problem with some code,just starting out
Its basically a guessing game in vb

Public Class frmMain

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click

        Dim randNum As Integer
        Dim guess As Integer = Convert.ToInt32(txtGuess.Text)


        Randomize()
        randNum = Int(20 * Rnd()) + 1


        Do Until randNum = guess


            If guess > randNum Then
                txtHint.Text = "Too High"
            ElseIf guess < randNum Then
                txtHint.Text = "Too Low"
            End If

        Loop
        txtHint.Text = "Correct guess"
buzzykerbox 0 Light Poster

Thanks very much, thats what happened when i ran the program,it would always output num2

buzzykerbox 0 Light Poster

Sorry made a few mistakes in the first post,have to find the highest and lowest of 5 integers,and i cant use arrays yet,when i run the program it doesn't display the right number.This is how i'm doing it

high=num1;                  
                  if (num2>high)
                         {                
                           high=num2;
                         }
                   else if(num3>high) 
                         {
                           high=num3;
                         }                              
                   else if (num4>high) 
                          {
                          high=num4;
                          }
                   else if (num5>high) 
                          {
                           high=num5; 
                          }          

cout<<:the"the highest number is "<<high;
buzzykerbox 0 Light Poster

Hey Guys and Gals,I'm writing a program to find the highest and lowest of 5 integers.I think i have the algorithm almost right but it doesn't work.I think its something simple.......as usual.........

include <iostream.h>
include <conio.h>

int main ()


{
       double total=0,num1,num2,num3,num4,num5,high,low;
       

       cout<<please enter number;
       cin>>num1;
       cout<<please enter number;
       cin>>num2;
       cout<<please enter number;
       cin>>num3;
       cout<<please enter number;
       cin>>num4;
       cout<<please enter number;
       cin>>num5;


      high=num1
      if (num1>high) high=num1;
      else if (num2>high) 
         {
          high=num2;
          }