This commit is contained in:
hanjian
2024-08-14 15:17:51 +08:00
parent 20a221c1a2
commit b610f94b2e
3483 changed files with 650965 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<p style="color:#F00;">||-------hello Ajax!-------||</p>
<p>这里是ajax加载的html代码</p>
<script>
setTimeout(function(){
alert('jQuery html方法可以执行HTML片段自带的javascript');
}, 1000);
</script>

View File

@@ -0,0 +1,6 @@
{
"code": 0,
"users": ["糖饼", "月月鸟", "水水", "丽丽", "花花", "大叔"],
"me": "糖饼",
"web": "http://www.planeart.cn"
}

View File

@@ -0,0 +1,96 @@
<div id="map" style="width:558px">
<div>地址: <input id="map_address" value="" style="width:200px; padding:4px;" /> <button id="map-search-sumbit">搜 索</button></div>
<div id="map_canvas" style="width:558px; height:360px;"></div>
</div>
<script type="text/dialog">
var dialog = this;
var getScript = function(src, fn, doc) {
doc = doc || document;
var script = doc.createElement('script');
script.language = "javascript";
script.charset = $.charset;
script.type = 'text/javascript';
script.onload = script.onreadystatechange = function() {
if (!script.readyState || 'loaded' === script.readyState ||'complete' === script.readyState) {
fn && fn();
script.onload = script.onreadystatechange = null;
script.parentNode.removeChild(script);
};
};
script.src = src;
doc.body.appendChild(script);
};
getScript("http://maps.googleapis.com/maps/api/js?sensor=false&language=zh_CN", function () {
var map, geocoder;
function initialize() {
var latlng = new google.maps.LatLng(39.904214, 116.407413);//39.904214,116.407413
var options = {
zoom: 11,
center: latlng,
disableDefaultUI: true,
panControl: true,
zoomControl: true,
mapTypeControl: true,
scaleControl: true,
streetViewControl: false,
overviewMapControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), options);
geocoder = new google.maps.Geocoder();
geocoder.geocode({latLng: latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[3]) {
document.getElementById("map_address").value = results[3].formatted_address;
}
}
});
dialog.title('google mpas')
.button({name: '截图', callback: function () {
var center = map.getCenter().lat() + ',' + map.getCenter().lng(),
zoom = map.getZoom(),
maptype = map.getMapTypeId(),
url = 'http://maps.googleapis.com/maps/api/staticmap';
url += '?center=' + encodeURIComponent(center);
url += '&zoom=' + encodeURIComponent(zoom);
url += '&size=558x360';
url += '&maptype=' + encodeURIComponent(maptype);
url += '&markers=' + encodeURIComponent(center);
url += '&language=zh_CN';
url += '&sensor=false';
art.dialog.through({title: false, content: '<img src="' + url + '" />', padding: 0, width: 558, height: 360, lock: true});
return false;
}, focus: true})
.position('50%', 'goldenRatio');
document.getElementById("map-search-sumbit").onclick = function () {
var input = document.getElementById('map_address');
search(input.value);
};
}
function search(address) {
if (!map) return;
geocoder.geocode({address : address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setZoom(11);
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Invalid address: " + address);
}
});
}
});
</script>

View File

@@ -0,0 +1,73 @@
<form id="login-form" action="?login" method="post">
<p><label>帐号:<input id="login-form-username" name="username" type="text"></label></p>
<p><label>密码:<input id="login-form-password" name="password" type="password"></label></p>
</form>
<!-- IE8 style 标签写在HTML片段下方才能生效 -->
<style>
#login-form p { padding:5px; }
#login-form input { width:15em; padding:4px; border:1px solid #CCC; }
#login-form input:focus { border-color:#426DC9; }
#login-form .login-form-error { background:#FFFBFC; border-color:#F00 !important; }
</style>
<!--
1、 script的类型如果是 text/dialog 将会在对话框内部执行类似init参数的回调变量不会污染全局
2、 如果使用jquery.artDialog标准script的标签也能被执行
3、 本页编码要与对话框所在页面编码保持一致
-->
<script type="text/dialog">
var api = this,// 对话框扩展方法
$ = function (id) {return document.getElementById(id)},
form = $('login-form'),
username = $('login-form-username'),
password = $('login-form-password');
// 操作对话框
api.title('系统登录')
// 自定义按钮
.button(
{
name: '登录',
callback: function () {
if (check(username) && check(password)) form.submit();
return false;
},
focus: true
},
{
name: '取消'
}
/*, 更多按钮.. */
)
// 锁屏
.lock();
username.focus();
// 表单验证
var check = function (input) {
if (input.value === '') {
inputError(input);
input.focus();
return false;
} else {
return true;
};
};
// 输入错误提示
var inputError = function (input) {
clearTimeout(inputError.timer);
var num = 0;
var fn = function () {
inputError.timer = setTimeout(function () {
input.className = input.className === '' ? 'login-form-error' : '';
if (num === 5) {
input.className === '';
} else {
fn(num ++);
};
}, 150);
};
fn();
};
</script>