Сообщение от danik.js
|
// коллекция всех форм
var $forms = $('form');
function json_example()
{
$.getJSON('json.php', function(data) {
$forms.each(function(i){
var color = data[i + 2] == 0 ? 'gray' : 'yellow';
$(this).find('[type=text], [type=submit]').css('background', color});
});
});
}
...
|
Спасибо за помощь!
Но у меня ничего не получилось
сделал страницу:
<html>
<head>
<title></title>
<script src="jquery.js"></script>
</head>
<body>
<form><input type=text value="333"><input type=submit value="Отправить" name="B1" style="width: 200; background-color: #000000"></forma>
<script>
// коллекция всех форм
var $forms = $('form');
function json_example()
{
$.getJSON('json.php', function(data) {
$forms.each(function(i){
var color = data[i + 2] == 0 ? 'gray' : 'yellow';
$(this).find('[type=text], [type=submit]').css('background', color});
});
});
}
</script>
</body>
</html>
обновляю постоянно, а цвет не меняется...