473,573 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find position where HTML starts on page

Hey Guys,

Am stuck, i need to create an overlaying DIV to a webpage, but i want
it to go over only the HTML content of the page. So if the page is
only within the middle 500px of the screen i want to be able to add my
overlay over that. And ignore the whitespace either side of it.

Does that make sense?

This div will be added via an ad stamp, so i wont be able to change the
page itself.

Any help, even something to look for/at would be much much appreciated.

Thanks in advance.

Andy

Oct 25 '06 #1
3 1514
ASM
daveyand a écrit :
Am stuck, i need to create an overlaying DIV to a webpage, but i want
it to go over only the HTML content of the page. So if the page is
only within the middle 500px of the screen i want to be able to add my
overlay over that.
How do you expect to not have you div in the *window* ?
How can you display a *div* anywhere in the *screen* ?
Does that make sense?
Isn't it css's job ?

stylesheet :
============
html, body { height: 100% }
#addDiv { position: absolute; top: 50%; left: 50%;
width: 350px; height: 250px;
margin-top: -125px; margin-left: -175px;
border: 1px solid black;
overflow: scroll;
}

javascript :
============
function addStamp(stamp) {
var d = document.create Element('DIV');
d.id = 'addDiv';
d.innerHTML = stamp;
document.body.a ppendChild(d);
}

Not tested !

--
ASM
Oct 25 '06 #2
The idea is to have something like this

function create_overlay( ) {
document.write( "<div style='z-index: 1000;'>BLah</div>");
}

and have all the other stuff within it. As said this could be on any
page so i wouldnt be able to add stuff into the page on their side, nor
will i be able to get them to add to much into th page either.

If that makes sense? So i could have the div on this current form
page, or the google homepage, or the Yahoo homepage and it should all
work the same, in taht it adds a floating div the same size as all the
HTML on the page and displays stuff. An annoying overlay advert type
thing.

Oct 25 '06 #3
ASM
daveyand a écrit :
The idea is to have something like this

function create_overlay( ) {
document.write( "<div style='z-index: 1000;'>BLah</div>");
}
document.write( "<div style='z-index: 1000;'>BLah<\/div>");

If that makes sense? So i could have the div on this current form
page, or the google homepage, or the Yahoo homepage
you have Google or Yahoo personalized home pages ?
(where you can write)

try (copy-paste in notepad) :

<html>
<script type="text/javascript">
function addStamp(stamp) {
var d = document.create Element('DIV');
d.id = 'addDiv';
d.onclick = function() { this.style.disp lay='none'; }
d.innerHTML = stamp;
document.body.a ppendChild(d);
}
var myStamp = 'that is only to see what happens. ';
for(var i=0;i<10;i++){m yStamp+=myStamp ;}
</script>
<style type="text/css" media="screen">
#addDiv { position: fixed; top: 50%; left: 50%;
width: 350px; height: 250px;
margin-top: -125px; margin-left: -175px;
border: 1px solid black;
overflow: scroll; background: lightyellow;
}
p { height: 350px; border: 1px solid red;}
</style>
<pblah 1</p>
<p><a href="javascrip t:addStamp(mySt amp)">stamp</a></p>
<p>blah 2</p>
</html>
IE will not like this fixed div :-(
..
Oct 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2669
by: CMAR | last post by:
I have been having a problem styling a page, which you can see live at my test site: Designer Page (http://home.ne.rr.com/thespar/) (Ignore the missing pictures, which have not been uploaded.) The page renders correctly in TopStyle and Dreamweaver 4, and also online in my test website, i.e., the 5 successive navigation divs are...
7
10108
by: DaWoE | last post by:
Hi, I want to place a div centered of another div in IE. I get this to work in Mozilla, but not in IE. The code i use for mozilla is the following : <html> <head> <style type="text/css">
1
1708
by: Anna K. | last post by:
Hi Experts, I'm new to JavaScript and web-based apps development, so I'll tell you right off that I don't really know my way around it as of yet. I'm trying to create a code library set with JavaScript (in DreamweaverMX) to display "buttons" with which to select pages in a gallery. I'm trying to "grey out" (and disable) the button for the...
7
7978
by: Doc | last post by:
I've read in a couple of different places including the archives of this forum that html doesn't allow you to precisely dictate the position of an image, but I found this command (again in the archives of this forum) that apparently allows you to do exactly that. <img src="whateveryourfilelocationis" style="position:absolute; left:Xpx;...
4
4737
by: KL | last post by:
Hello again, I am still working on this homework assignment and have hit a wall. I have a list that I want to fill with all occurences of img tags from a big string of html code. So I have a string called str which holds the html code and I want to find the string str1 which would be <img and then write to the list an item that contains...
17
2632
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I find the size of a browser window? ----------------------------------------------------------------------- Where supported in NN: (>NN4.0) var winWidth = window.innerWidth; var winHeight = window.innerHeight; Where supported in IE: (>IE4.0)
4
26481
by: vunet.us | last post by:
I have a DIV element. How can I find mouse position (top and left) inside of this DIV? <div onMouseMove="getPositions();" style="width:200px;height:100px"></div> function getPositions(ev){ ???????????????? }
2
2063
by: everly | last post by:
Hi, I'm helping my friends band and making their MySpace. I messed something up and I can't figure out what it is. Everything is all out of whack on the bottom half of the page. The comments shouldn't be on the left hand side. Help please! Thanks. ____________________________________________________- <style type="text/css"> { Background...
6
4898
by: =?Utf-8?B?U2NvdHQgVHJpY2s=?= | last post by:
I followed the instructions from MSDN for Webclient UploadFile and I get an error: Could not find file 'C:\testfile.xls'. If I add the file (c:\testfile.xls) to the server I do not get the error and the file is copied from the server to the server, rather than from the web client to the server. Please help!!!
0
7780
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8202
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7787
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8065
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5593
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5291
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3733
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2213
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1303
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.