2014-05-13 113 views
0

我一直在使用来自www.dynamicdrive.com的传送带幻灯片脚本。我想让图像的高度成为可变值。继承人的代码。html标记中的java脚本变量

var _docHeight = (document.height !== undefined) ? document.height : document.body.offsetHeight; 
var _docWidth = (document.width !== undefined) ? document.width : document.body.offsetWidth; 
var h; 

var w1 = window.innerWidth; 
var h1 = window.innerHeight; 
var w = w1/1.365; 
var h = h1 /1; 
//Specify the slider's width (in pixels) 
//Specify the slider's width (in pixels) 
var sliderwidth=w + "px" 
//Specify the slider's height 
var sliderheight=h + "px" 
//Specify the slider's slide speed (larger is faster 1-10) 
var slidespeed=2 
//configure background color: 
slidebgcolor="#000000" 
var h3 = 20; 

//Specify the slider's images 
var leftrightslide=new Array() 
var finalslide='2' 
leftrightslide[0]='<img src="0price.png" height="h" border=0></a>' 

请帮助

+0

这是你正在尝试做什么? '' –

回答

0

你拥有属于自己的语法错误 - 你没有把变量放到你的字符串正确。试试这个:

leftrightslide[0]='<img src="0price.png" height="'+h+'" border=0></a>'; 

希望这会有所帮助。

+0

谢谢伟大的工作 –

+0

随时upvote /接受如果答案帮助你:) – ArtOfCode

+0

我没有足够的声誉,但只要我做我会 –