Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Homepage? database?
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
firist
11y
1.1k
1
Reply
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!
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
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