SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot kiviniar's Avatar
    Join Date
    Aug 2006
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do i make it small ??? - Alexa widget

    Hi guys, want to use the traffic widget from Alexa....

    No when i build the widget, i get a javascript code as

    <SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/s/c?url=www.spillbean.com'></SCRIPT>
    which is for a Banner (468 x 60) (predifined)

    Can i customize the size of the banner as its just to big for my header...

    Suggestion would be appreciated

  2. #2
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hmmm... alexa didnt make it eassy, but can still be done only because they did not put it in a frame (if they would have put it in a frame you would have been SOL)...

    anyway you'd need to find out which image to resize first... which they also didnt make eassy because they didnt assign a name or id to it... so you would need to get it by matching "Alexa Certified Site Stats for www.spillbean.com" to all the alt tags in the page's images... ya that annoying...

    so... should be something like this:

    HTML Code:
    <html>
    
    <head>
    <script type="text/javascript">
    var ctimer = setTimeout('do_your_magic()', 20);
    
    function do_your_magic(){
    	var newheight = 60;
    	var newwidth = 468;
    	var found = false;
    	var imgs = document.getElementsByTagName('img');
    	for(i=0;i<imgs.length;i++){
    		if(imgs[i].getAttribute('alt') == "Alexa Certified Site Stats for www.spillbean.com"){
    			imgs[i].style.height=newheight;
    			imgs[i].style.width=newwidth;
    			found = true;
    		}
    	}
    	if(found){
    		ctimer = clearInterval(ctimer);
    	}else{
    		ctimer = setTimeout('do_your_magic()', 20);
    	}
    }
    </script>
    </head>
    
    <body>
    <SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/s/c?url=www.spillbean.com'></SCRIPT>
    
    </body>
    </html>
    note: you need to change the hight and width you want it to be in the code...

    also i had to use a timer to make it compatable with main browsers.

    that should do it,
    -ALL
    Did I help you?
    You can repay me, support one of my projects (no money needed):
    JavaScript Wiki, Another Web Forum, Paranormal Site

  3. #3
    SitePoint Zealot kiviniar's Avatar
    Join Date
    Aug 2006
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Finally after years of searching.....i finally found someone who could alswer my question.....

    Thanks ALL

    will try what u suggested

    Edit..::added::..just to let u guys know, this sure does work

    Just the image gets a bit distorted, so can use it anyways

  4. #4
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    you cant really do much about the distortion... you however make sure the shrinkage is relative...

    you can do this with a calculation...

    if you are constrining by the width:

    h / w * nw = nh
    h = current height
    w = current width
    nw = what the new width should be
    nh = what the new height will be

    or if you have a decent image editing software most have a constrain buton/checkbox and just resize it to find out what the height should be.

    -ALL
    Did I help you?
    You can repay me, support one of my projects (no money needed):
    JavaScript Wiki, Another Web Forum, Paranormal Site

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm i'm confused, they make smaller traffic stat buttons:

    HTML Code:
    <SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/t/a?url=www.spillbean.com'></SCRIPT>
    120x65

    or did you need it to be shorter?

  6. #6
    SitePoint Zealot kiviniar's Avatar
    Join Date
    Aug 2006
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    or did you need it to be shorter?
    Na have given up the idea for now, not until i increase the header width,,,

    Thanks u all anyways and especially "ALL"


Bookmarks

Posting Permissions

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