redirection url avec champ formulaire.
Bonjour,
je souhaite créer un champ liste avec divers nom de site web qui puisse rediriger un utilisateur (appelons le Bob) vers le site en popup.
Voici où j'en suis :
(j'utilise jquery)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/main.css" type="text/css" />
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css" type="text/css" />
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script>
var data = [
{text:'Web Design', url:' http://www.nimpkish.com/web-design'},
{text:'Web Development', url:'http://www.nimpkish.com/web-development'},
];
$('#autoComplete').autocomplete(data, {
formatItem: function(item) {
return item.text;
}
}).result(function(event, item) {
location.href = item.url;
});
</script>
</head>
<body>
<div>
<input id="autoComplete" />
</div>
</body>
</html> |
Je me suis basé sur ce link :
http://nimpkish.com/blog/jquery-auto...e-and-data-set
et
http://docs.jquery.com/Plugins/Autocomplete
merci pour votre aide.