473,414 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

help to add an image over the webpage!

snjflame
hi, I want add an PNG image using .js and it should appear like this twitter badge,
link: http://www.go2web20.net/twitterFollowBadge/

- it should not move while scrolling like this twitter badge,
- can anybody make me a javascript and html code for that!
Feb 12 '10 #1
3 1397
Quite easy. Use HTML to code your image and put it in a div layer. Make the CSS position attribute of the layer "absolute" and make the height and width of the layer the same as the image. Also set the top attribute so that it is the desired distance down from the top. Now, use javascript to find the width of the client's screen. See this website for details on getting a client's width/height: http://www.howtocreate.co.uk/tutoria.../browserwindow

Finally get access to the layer using document.getElementById or something, then set the left attribute of the layer's style property to the width of the screen minus the width of your layer. You might also want to create a function called onResize which updates the position of the layer so it is still right-aligned.
Feb 12 '10 #2
thx, for the reply, but don't know javascript?
Feb 12 '10 #3
Put this inside javascript script tags. It's only a very basic solution and won't yet update on page resize.

Expand|Select|Wrap|Line Numbers
  1.   var myWidth = 0;
  2.   if( typeof( window.innerWidth ) == 'number' ) myWidth = window.innerWidth;
  3.   else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) myWidth = document.documentElement.clientWidth;
  4.   else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) myWidth = document.body.clientWidth;
  5.   document.getElementById("PUT YOUR ID HERE").style.left = parseInt(myWidth - 25)+"px"; //replace the 25 with the width of your graphic
  6.  
Feb 12 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: codeslayer | last post by:
Greetings to everyone in ‘forum-land': I have a problem that has plaguing me to no end. It is a CSS-related question, and I have not seen this question posted anywhere in forums or through...
3
by: Klaus Andersen | last post by:
Hi I am looking for a component that can generate images from html - serverside. Does anyone have a suggestion for components or ways to do that? Kind regards KA
0
by: prakash | last post by:
Dear Friends I am new guy to Visual C++.NET I've program to save website as a image vc++.net . It have a function "SaveSnapshot" to save the webpage as an image On that function ifor saving...
4
by: Mahmoud Mousa | last post by:
Hi... Some how I'm facing trouble Saving A Bitmap(I Dynamiclly creat in my Page) Co's Every Time to Started to save the Image.. The Only thing that Appears in my Page is the Image Alone And If I...
5
by: Buchwald | last post by:
hello group, I have a long (large) script that shows a random picture when a webpage is refreshed. It's long because i have a lot of pictures: 246 Here is some code:...
5
by: Martin | last post by:
I'm a newbie to Java and have today completed my first Java applet. It's a panorama viewer which i intend to use on my website instead of Apple's Quicktime Virtual Reality (QTVR) format. I've...
5
by: Jeff | last post by:
Hey asp.net 2.0 I have a webpage which generate thumbnail images. In another webpage I want to display these images... I tryed using this solution: <img ID="photo"...
0
by: samjam | last post by:
Below is some coding in a program i am using, i would like to know how i can get the text bigger or bolder on my webpage, This is the section of text i would like bigger or bolder (This is a very...
0
by: levi2713 | last post by:
We have IP cameras that we can view by putting the IP address in a web browser. This is a control panel type webpage, but I can go a step further and go to http://<ip address>/capture.html and it...
6
by: Jeff | last post by:
hi asp.net 2.0 I have a image (.jpeg) stored in sql server 2005 and now I want to display it on a webpage. So I created a webpage (Image.aspx) which just writes the buffer data to the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.