When I run this code
var button=document.getElementById("button")
if (navigator.userAgent.indexOf('iPhone') != -1)
{
button.style.left = 250;
}
The error is result of expression is not an object. The object "button" is in the css file and it is the only one named button. What a开发者_如何转开发m I doing wrong? Does it have something to do with the button being in the header? I'm using dashcode.
Try
var button=document.getElementById("button").object
getElementById
gives you the HTML DOM node for the button; you have to access its object
to do all of the fancy Dashcode stuff to it. (I stumbled around with the same question for a while!)
精彩评论