В этой статье описывается метод масштабирования JS изображений JS. Поделитесь этим для вашей ссылки, следующим образом:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html; charset = gb2312"/> <название> javascript автоматически отображает Pictress, Compresses in proplets </> type = "text / javascript"> функция AutoreSizeImage (maxWidth, maxheight, objimg) {var img = new image (); img.src = objimg.src; var hratio; var wratio; vario = 1; var w = img.width; var h = img.height; maxheight/h; if (maxwidth == 0 && maxheight == 0) {cutio = 1;} else if (maxwidth == 0) {// if (hratio <1) inatio = hratio;} else if (maxheight == 0) {if (wratio <1) utio = wratio; hratio <1) {cutio = (wratio <= hratio? wratio: hratio);} if (соотношение <1) {w = w * соотношение; h = h * соотношение;} objimg.height = h; objimg.width = w;} </script> </head> <body> <br/> <img strc strc strc strc g; Onload = "AutoresizeImage (100,0, это)" /> Ширина: 100px <br /> <br /> <img src = "1.jpg" Onload = "AutoreSizeImage (0,100, это)" /> Высота: 100px <br /> <br /> <img src = "1.jpg" на загрузке = "autoresizemage (100,100, это). Высота: 100px <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> < /body> < /html>For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of Алгоритмы и методы обхода JavaScript »и« Сводка использования математических операций JavaScript ».
Я надеюсь, что эта статья будет полезна для каждого программирования JavaScript.