vendredi 25 mars 2016

Javascript Random Text Script sorted by categories

I need your help. I want to create a form with a script that displays the user a random quote but sorted by categories. So if the user fills out a form ,by choosing in a drop down menu from different categories (for example the category "funny"), only quotes will be displayed from this category. So if the user chooses the category "funny" and submits his form there should be one quote displayed from the category "funny". If the user chooses the category "serious" there should be after submitting one quote out of the category "serious". The text should be displayed as normal text but only after the form is submitted. I hope you get my point. Im totally lost and have no clue how to start out. The only very very basic code I know is this:

<script language="JavaScript">
<!--
var r_text = new Array ();
r_text[0] = "text1";
r_text[1] = "text2";
r_text[2] = "text3";

var i = Math.floor(3*Math.random())
document.write(r_text[i]);
//-->
</script>




Aucun commentaire:

Enregistrer un commentaire