解决方案 »
- 问题求助
- xml对于前端开发人员的重要性
- ##$$$看这个js操作dom问题
- 客户端事件如何触发服务器端行为(如何通过javascript实现点击客户端浏览器打印按钮触发服务器端对数据库的修改?)
- 请问radio的input怎么判断?
- 求助用什么方法可以最快替换一窜字符串中用"["和"]"圈住的内容?
- 如何将点击文字链接以后弹出的一张图片的页面,使弹出的web页面于图片一样大
- 能否在一个函数里写语句,使网页直接提交!
- alert((100.2556866243413).toFixed(5));错误
- 一个js替换脚本,能放在浏览器书签里,点一下就执行的
- linux服务器上<option>标签的点击事件没有效果,window上本地测试有,求原因?
- 一个关于undefined的问题
var allElements = document.getElementsByTagName('*')
for(var i = 0; i < allElements.length; i++){
if(allElements[i].className.indexOf(InclassName) >= 0){
var imgElements = allElements[i].getElementsByTagName('img');
for(var j=0; j < imgElements.length; j++){
if( imgElements[j].width > widthRestriction || imgElements[j].height > heightRestriction ){
if( imgElements[j].width > imgElements[j].height){
imgElements[j].height = imgElements[j].height*(widthRestriction/imgElements[j].width);
imgElements[j].width = widthRestriction;
}else{
imgElements[j].width = imgElements[j].width*(heightRestriction/imgElements[j].height);
imgElements[j].height = heightRestriction;
}
}
if( imgElements[j].height < heightRestriction ){
imgElements[j].style.paddingTop = ( heightRestriction -imgElements[j].height ) /2 + "px";
}
} /*for j*/
}
}/*for i*/ }是要这样的吗?把相应的参数放的位置一变就可以了
多了一个.