JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old February 15th, 2005, 10:24 AM
RobT RobT is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 7 RobT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 38 sec
Reputation Power: 0
Question Setting Div positions in mozilla

how do we set the div positions in mozilla, I've got my script to be able to position the div's in opera, IE and safari but not in mozilla, does it handle positioning div's diffrently from all the rest?

I'm trying to capture the the mouse position and move the div absolutly on the page, where I click. Is there any way I can do this that will work in both mozilla and IE?

Reply With Quote
  #2  
Old February 15th, 2005, 11:51 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
What does your most recent script look like?

Reply With Quote
  #3  
Old February 15th, 2005, 12:02 PM
RobT RobT is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 7 RobT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 38 sec
Reputation Power: 0
Its really rough, my code is dynamically generated. but this is a simple version of it.
Code:
<html>
<head>
<script type="text/javascript" language="JavaScript">
<!--
var IE = document.all ? 1 : 0
var ns = document.layers ? 1 : 0
 
// Let's set value we're going to use for each 
var isHidden = 0;
/////////////////////////////////////////////////////////////////////////////////////////
// checkDiv()
//
// Parameters:
// name - This is the name of the div we are creating.
//
// Returns:
// An object with values to control the Div.
/////////////////////////////////////////////////////////////////////////////////////////
function checkDiv(name)
{ 
// The first tiem we come in here we will have to define the div's hidden value.
if(document.getElementById(name).isHidden == "undefined")
{
// Let's check set the value.
document.getElementById(name).isHidden = 1
}
// If the hidden value isn't set then we are trying to show the div.
if(document.getElementById(name).isHidden == 0)
{
// Let's hide the div.
document.getElementById(name).style.visibility = "hidden"
// Let's set a value of the isHidden flag.
document.getElementById(name).isHidden = 1
}
else
{
// If isHidden is not set to one let's show the div.
document.getElementById(name).style.visibility = "visible"
// Let's reset the hidden flag.
document.getElementById(name).isHidden = 0
}
}
function show_coords(name)
{
if (IE) { // grab the x-y pos.s if browser is IE
xPos = event.clientX + document.body.scrollLeft
yPos = event.clientY + document.body.scrollTop
} else { // grab the x-y pos.s if browser is NS
xPos = e.pageX
yPos = e.pageY
}
// catch possible negative values in NS4
if (xPos < 0){xPos = 0}
if (yPos < 0){yPos = 0} 
document.getElementById(name).style.top = (yPos - 60)
document.getElementById(name).style.left = (xPos - 187)
}
 
//-->
</script>
 
 
<style type="text/css">
#addList_534
{
position: absolute;
visibility: hidden;
z-index: 534;
left: 570px;
top: 20px;
}
</style>
</head>
<body bgcolor="#ffffff">
<table align="center">
<tr>
<td>
<br><br><br><br><br>
<a href="#"><img src="images/buttons/add_lblu_bg.gif" alt="Add list" border="0"title="Add list" onclick="javascript:checkDiv('addList_534');javascript:show  _coords('addList_534')"></a>
</td>
</tr>
</table>
 
<div id="addList_534"><table cellpadding="5" cellspacing="0" width="200" class="blackBorder" bgcolor="white"><tr><td width="145" rowspan="2"><table cellpadding="2" cellspacing="0" border="0"><tr><td><a href="#" class="boxLink">Add Email List</a></td>
</tr>
<tr><td><a href="#" class="boxLink">Add Mobile List</a></td>
</tr>
<tr><td><a href="#" class="boxLink">Add Email & Mobile List</a></td>
</tr>
</table>
</td>
<td><a href="#"><img src="images/buttons/close_layer.gif" alt="close" border="0"title="close" onclick="javascript:checkDiv('addList_534');javascript:show  _coords('addList_534')"></a></td>
</tr>
<tr><td align="right" valign="bottom"><img src="images/buttons/add_wt_bg.gif" alt="Add list" border="0"title="Add list"></td>
</tr>
</table>
</div>
 
</body>
</html>

Reply With Quote
  #4  
Old February 15th, 2005, 12:45 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
In the future, or even now [edit your post], please wrap your code in [code][/code] tags when posting to the forum... this helps to unclutter the thread, and it preserves your indentation...

excellent commenting by the way!
I'll look into your problem when I have time [hopefully tonight, or over the next few days]...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Setting Div positions in mozilla


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway