TRY:<img id="img1" src="http://localhost/ggao/tupian/1.gif" border="0"><script language="javascript">
var a = "http://localhost/ggao/tupian/1.gif";
img1.src = a;
</script>

解决方案 »

  1.   

    http://localhost/ggao/tupian/1.gif这个地址,我从数据库中读出来的,把这个地址,复制到变量里,然后,用变量实现,超连接。var aabb="http://localhost/ggao/tupian/1.gif";
        <a href=http://www.flash8.net  target=_blank><img id="img1" img1.src=aabb border=0></a>现在还是没有显示!这是怎么回事。
      

  2.   

    <script language="javascript">
        var aabb = "http://localhost/ggao/tupian/1.gif";
        document.write("<a href=http://www.flash8.net target=_blank><img src="+aabb+" border=0></a>");
    </script>
      

  3.   


        var aabb = "http://localhost/ggao/tupian/1.gif";
        document.write("<a href=http://www.flash8.net target=_blank><img src="+aabb+" border=0></a>");只显示单个图片可以正常显示,但我加上格式和样式,就不行了,我给怎么写下面的语句?
    但我用
    var aabb = "http://localhost/ggao/tupian/1.gif";
        theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br>document.write("<a href=http://www.flash8.net target=_blank><img src="+aabb+" border=0></a>")';
    提示我有错误显示不了,我下面的语句该怎么写,求高人指教,谢谢大家!!~
      

  4.   

    只要这样引用:
    var a="http://localhost/ggao/tupian/1.gif";
    <img src=&{a}; border=0>
    即可
      

  5.   

    theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br>document
    你這什麼意思呀??
    先分清腳本跟ASP代碼吧。
      

  6.   

    theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br><a href=http://www.flash8.net target=_blank> <img src=&{aabb} border=0></a>');提示我有错误。我要做个,  var theFloaters        = new floaters();是在JavaScript定义的。用于浮动广告用的。var aabb = "http://localhost/ggao/tupian/1.gif";theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br><a href=http://www.flash8.net target=_blank> <img src=&{aabb} border=0></a>');
    我应该怎么写!才能正确显示!
      

  7.   

    /*这是,也面全部代码,请问,该怎么样改写??*/
    <html>
    <body>
    <script language="javascript">
        var delta=0.15
        var collection;
        function floaters() {
            this.items    = [];
            this.addItem    = function(id,x,y,content)
                      {
                        document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute;  width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
                        
                        var newItem                = {};
                        newItem.object            = document.getElementById(id);
                        newItem.x                = x;
                        newItem.y                = y; 
                        this.items[this.items.length]        = newItem;
                      }
            this.play    = function()
                      {
                        collection                = this.items
                        setInterval('play()',10);
                      }
            }
            function play()
            {
                if(screen.width<=800)
                {
                    for(var i=0;i<collection.length;i++)
                    {
                        collection[i].object.style.display    = 'none';
                    }
                    return;
                }
                for(var i=0;i<collection.length;i++)
                {
                    var followObj        = collection[i].object;
                    var followObj_x        = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
                    var followObj_y        = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y); 
                    if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
                        var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
                        dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
                        followObj.style.left=followObj.offsetLeft+dx;
                        } 
                    if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
                        var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
                        dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
                        followObj.style.top=followObj.offsetTop+dy;
                        }
                    followObj.style.display    = '';
                }
            }    
            
        var theFloaters        = new floaters();
    //上面是对,浮动图片的控制//这样单独可以显示,但不能在 theFloaters.addItem 里显示!?
        var aabb = "http://localhost/ggao/tupian/1.gif";
        document.write("<a href=http://www.flash8.net target=_blank><img src="+aabb+" border=0></a>");//我不用变量直接,赋给src地址就可以显示!但用了变量就不行了,应该怎么写!?
        theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<br><a href=http://localhost/ggao/js.aspx?id=1 target=_blank><img src=http://localhost/ggao/tupian/1.gif  border=0></a>');
    //我改的这句,就显示不了,请问错在哪,应该怎样改写下面这段代码!
        theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br><a href=http://www.flash8.net target=_blank> <img src=&{aabb} border=0></a>');
    //我如何才能用aabb变量 在theFloaters.addItem里正常显示?    theFloaters.addItem('followDiv3','document.body.clientWidth-106',142,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');    theFloaters.addItem('followDiv4','document.body.clientWidth-106',173,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');    theFloaters.addItem('followDiv5','document.body.clientWidth-106',204,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');    theFloaters.addItem('followDiv6','document.body.clientWidth-106',235,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');    theFloaters.addItem('followDiv11',6,80,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');     theFloaters.addItem('followDiv12',6,111,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');     theFloaters.addItem('followDiv13',6,142,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');     theFloaters.addItem('followDiv14',6,173,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');     theFloaters.addItem('followDiv15',6,204,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');     theFloaters.addItem('followDiv16',6,235,'<br><a href=http://www.flash8.net target=_blank><img src=http://www.020job.com/images/ad/zsnet.gif  border=0></a>');     theFloaters.play();    </script>
    </body>
    </html>
      

  8.   

    //我不用变量直接,赋给src地址就可以显示!但用了变量就不行了,应该怎么写!?
        theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<br><a href=http://localhost/ggao/js.aspx?id=1 target=_blank><img src=http://localhost/ggao/tupian/1.gif  border=0></a>');
    //我改的这句,就显示不了,请问错在哪,应该怎样改写下面这段代码!
        theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br><a href=http://www.flash8.net target=_blank> <img src=&{aabb} border=0></a>');//改成这样试试
        theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br><a href=http://www.flash8.net target=_blank> <img src='+aabb+'} border=0></a>');
      

  9.   

    看看是不是路径问题.路径是对的。//改成这样试试
        theFloaters.addItem('followDiv2','document.body.clientWidth-106',111,'<br><a href=http://www.flash8.net target=_blank> <img src='+aabb+'} border=0></a>');改成上面那样还是不行,。。55555急