Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    binding with prototype 1.6

    I am new to prototype, thought it would be easiest way to accomplish cross browser compatibility... but alas, syntax escapes me in binding! Heeeeres... my code!
    Code:
    function OrbCreator(){
    var b = new Element('img',{src: '../images/Orb.png', position: 'absolute', display: 'none', left: '10000px', top: '0px', width: '100px', height: '100px', zIndex: '0'});
    $('container').insert(b);
    this.set=setAttribute(b,);
    }
     
    function moveOrb(x,y,z){
    left=x-Os;
    top=y-Os;
    zIndex=z;
    height=Os;
    width=Os;
    opacity=1/z;
    display='block';
    this.set=display:display,left:left,top:top,width:width,height:height,zIndex:zIndex,opacity:opacity;
    if(renew=2){
    this.set({src:"../images/NewImage.png"});
    }
    if($('message').getStyle('top')>0){
    writeAttribute("message",{top: top++})
    }
    }
    So slap me silly and call me names, but what am I doing wrong and please, very importantly... why is it wrong and what is right, why?

  • #2
    New Coder
    Join Date
    May 2009
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Having a little success with this code:
    Code:
    function OrbCreator(){
    	var b = new Element('img',{src: '../images/Orb.png', position: 'absolute', display: 'none', left: '10000px', top: '0px', width: '100px', height: '100px', zIndex: '0'});
    	$('container').insert(b);
    	this.img=b;
    	this.move=moveOrb;
    }
     
    function moveOrb(x,y,z){
    	Left=x-Os;
    	Top=y-Os;
    	ZIndex=z;
    	Height=Os;
    	Width=Os;
    	Opacity=1/z;
    	Display='block';
    	this.img.setAttribute(this.img,{display:Display,left:Left,top:Top,width:Width,height:Height,zIndex:ZIndex,opacity:Opacity});
    	if(renew=2){
    		this.img.setAttribute({src:"../images/NewImage.png"});
    	}
    	if($('message').getStyle('top')>0){
     		writeAttribute("message",{top: top++})
    	}
    }
    firebug error is "String contains an invalid character" code: "5
    [Break on this error] this.img.setAttribute(this.img,{display...:Height,zIndex:ZIndex,opacity:Opacity});"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •