|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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? |
|
#2
|
||||
|
||||
|
What does your most recent script look like?
|
|
#3
|
|||
|
|||
|
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>
|
|
#4
|
||||
|
||||
|
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]... |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Setting Div positions in mozilla |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|