•

< ?php wp_list_categories('show_count=1&title_li=&exclude=341'); ?>

•

•

## Questions Categories

< ?php wp_list_categories('show_count=1&title_li=&child_of=341'); ?>

## JavaScript random function

Q: How do I create a JavaScript random function that does not return two consecutive identical results?

A: Random functions are always interesting topics but this one just caught my eye because the user wanted a random function that did not repeat two numbers in a row. This means 1,2,1,5 is acceptable but 1,1,2,5 is not because there are two returns in a row that have the same value.

Thankfully JavaScript makes this a very easy task for us. We will create a global called randNum and set it equal to 0 and then we will create a function called randNoDups that will take an argument of maxNum (which will be 1 larger than the largest number possible).

The key is to look at our current random number and compare it to our last random number. If they are equal to each other then we need to generate another random number. Here is the code!

<script language=”JavaScript”>
var randNum = 0;
function randNoDups(maxNum)
{
tmpRand = randNum;
while (tmpRand == randNum) {
tmpRand = Math.round(Math.random()*maxNum);
}
randNum = tmpRand;
return tmpRand;
}
</script>

## Where do I get my credit report?

Q: How do I find out about my credit report and what the report means?

A: You are allowed to get a free copy of your credit report from each of the 3 credit reporting agencies once a year. You can also visit the FTC website to find out more about credit reports and your rights. It is important to review your credit report to make sure the information on it is correct. Having incorrect information on your report can hurt you when you to go get a loan.

The downside to the free credit report is that it is missing a key feature that creditors look at when it comes to credit reports. They are missing the credit score. A credit score is one of the main factors in what interest rate you will get on your loans and credit cards.

When I started looking into credit report and my credit score I decide to use a company called myFICO and I used their Suze Orman’s FICO credit kit product which has a virtual Suze Orman walk you though your credit report telling you what you are doing wrong and what you are doing right. She also gives you pointers for increasing your score.

## Calling a function in JavaScript a few seconds after page load

Q: How do you call a function, using JavaScript, in your web browser a few seconds after a page loads? We would like to display a portion of a page for about 5 seconds and then minimize the section after that.

A: To call a function once a page load you want to use the onLoad method in the body tag of your html. To do the delayed call we will need to use the JavaScript function window.setTimeout( function, time ).

The two arguments that the function takes are the function you want to call and the time in milliseconds you want it to wait before calling that function.

Putting both together we would use the code below to achieve what this user was trying to do.

## Welcome To Ask A Geek

Ask A Geek is a site where users can submit their questions and experts in the related fields will respond with answers. The topics will start out related to web technologies and computers. However, all questions are welcome.