TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
firist
NA
1
1.4k
Homepage? database?
Nov 12 2012 8:40 AM
Hello,
I wanted to create a script that generate 1 of 3 random links.
But each link should be output only 1 time.
At the moment I have the followring script:
<script type='text/javascript'>
<!--
var a=i=0;
var spruch = new Array();
spruch[i++] = "http://www.link-1.com";
spruch[i++] = "http://www.link-2.com";
spruch[i++] = "http://www.link-3.com";
function ateball() {
a = Math.random();
b = a * spruch.length;
var rand_url = document.getElementById('zufianwser').innerHTML=spruch[Math.round(b)];
document.write('<a href="' + rand_url + '">' + rand_url + '</a>');
document.getElementById('zufibutton').value="Create a new Link";
}
//-->
</script> <input type="button" onclick="ateball()" id="zufibutton" name="zufibutton" value="Create a Link" /><br />
<div id="zufianwser">Klick the Button to get a Link</div>
If somebody click on the Button a random Link will be shown.
Then the script have to create a new row the the name of the link as value.
If somebody else click on the button the script have create a random link, that won't be exist in the database.
If all 3 Links exist in the database, the script have to write "ERROR".
But I don't know, How I can use a database on it!
Reply
Answers (
0
)
Is there an array method to return the how many elements are a value of 1?
How to use an c# alias to save time writing commands