开发者

Need a little help with this iframe scrolling issue

I'm attempting to do some scrolling with an iframe, but my Javascript doesn't seem to be working.

Here's my code...

<html>
<head>
<script type="text/javascript">
    function loadorder() {
    theFrame = document.getElementsByName("iframename");

    if (theFrame <> null) {
       theFrame.src="";
       theFrame.contentWindow.scrollTo(528,65)
    }
    else {
        alert("could not get iframe element!");
    }
}
</script>
</head>
&l开发者_Go百科t;body>
    <iframe name="iframename" src="http://www.domain.com/otherpage.html" frameborder="0"></iframe>
</body>
</html>

I got this code from another site and have modified it a little to fit my needs.

Basically what I'm trying to do is show a banner from another HTML page in the iframe on this page.

It's all on the same domain though, so I'm not really sure why this isn't working...


Like Ktash said the SQL not equal won't work in javascript:

if (theFrame <> null) 

However, with javascript null and undefined equates to false. So you can do this:

// if theFrame exists...
if (theFrame) {
   theFrame.src="";
   theFrame.contentWindow.scrollTo(528,65)
}
else {
    alert("could not get iframe element!");
}


Your <> is not a valid operator. I think you mean !=.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜