so i got script like that
[HTML]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Drag and Drop</title>
<style>
#slater {
display:block;
width:13px;
height:22px;
background:url( slater.gif);
cursor:pointer;
position:relati ve;
border:0px;
}
#main_box {
position:relati ve;
width:113px;
height:22px;
background:url( background_slat e.jpg) no-repeat;
border:0px;
}
</style>
<script>
if (navigator.appN ame == "Microsoft Internet Explorer") { var Browser = "IE"; } else { var Browser = "FF"; }
var MoveIT = "";
function startDrag() {
OffsetX = MouseX - (document.getEl ementById('slat er').style.left ).replace("px", "");
MoveIT = "yes";
}
function mouseMoveFF(eve nt) {
MouseX = event.clientX;
if (MoveIT == "yes") {
document.getEle mentById('slate r').style.left = MouseX - OffsetX;
if(document.get ElementById('sl ater').style.le ft.replace("px" ,"") <= 0) {
document.getEle mentById('slate r').style.left = 0+"px";
} else if ((document.getE lementById('sla ter').style.lef t.replace("px", "")) >= 100) {
document.getEle mentById('slate r').style.left = 100+"px";
}
var speed = document.getEle mentById('slate r').style.left. replace("px","" ) / 10;
var fix_pt = (document.getEl ementById('slat er').style.left != "0pt") ? speed : '0';
document.getEle mentById('speed ').innerHTML = fix_pt;
}
}
function mouseMoveIE() {
MouseX = event.clientX;
if (MoveIT == "yes") {
document.getEle mentById('slate r').style.left = MouseX - OffsetX;
if(document.get ElementById('sl ater').style.le ft.replace("px" ,"") <= 0) {
document.getEle mentById('slate r').style.left = 0+"px";
} else if ((document.getE lementById('sla ter').style.lef t.replace("px", "")) >= 100) {
document.getEle mentById('slate r').style.left = 100+"px";
}
var speed = document.getEle mentById('slate r').style.left. replace("px","" ) / 10;
document.getEle mentById('speed ').innerHTML = speed;
}
}
if (Browser == "IE") { document.onmous emove = mouseMoveIE; } else { document.onmous emove = mouseMoveFF; }
document.onmous eup = function () { MoveIT = ""; }
</script>
</head>
<body>
<div id="main_box">
<div id="slater" onMouseDown="st artDrag()"></div>
</div>
<div id="speed" style="font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#666666;" >0</div>
</body>
</html>
[/HTML]
so it works file but this is my problem it's made on <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> HTML 4.0 Transitional i need it to be <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d"> but this i my problem when i change HTML 4.0 Transitional to XHTML 1.0 Transitional it stops working so can some one tell me how to make my script work with XHTML 1.0 Transitional (on ie XHTML 1.0 Transitional works but not on FF)
14 3050
Take the script out of the html and link to it with
<script type="text/javascript" src=></script> in the head, and include a title element in the head.
put the event assignment in an onload call in the remote script.
i did like this and it still not working
[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257" />
<title>Drag</title>
<script type="text/javascript" language="javas cript" src="script.js" ></script>
<link type="text/css" rel="stylesheet " href="css.css" />
</head>
<body>
<div id="main_box">
<div id="slater" onMouseDown="st artDrag()"></div>
</div>
<div id="speed">0</div>
</body>
</html>
[/HTML]
have any ideas hat to do now??
but on ie it works
onload is not working or ma bey im not using it right can you tell me how to use it???
acoder 16,027
Recognized Expert Moderator MVP
Can you show what code you've tried?
PS. changed the thread title to better describe the problem.
HTML Code:
[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257" />
<title>Drag</title>
<script type="text/javascript" language="javas cript" src="script.js" ></script>
<link type="text/css" rel="stylesheet " href="css.css" />
</head>
<body>
<div id="main_box">
<div id="slater" onMouseDown="st artDrag()"></div>
</div>
<div id="speed">0</div>
</body>
</html>
[/HTML]
Javascript code: -
if (navigator.appName == "Microsoft Internet Explorer") { var Browser = "IE"; } else { var Browser = "FF"; }
-
var MoveIT = "";
-
-
function startDrag() {
-
OffsetX = MouseX - (document.getElementById('slater').style.left).replace("px","");
-
MoveIT = "yes";
-
}
-
-
function mouseMoveFF(event) {
-
MouseX = event.clientX;
-
if (MoveIT == "yes") {
-
document.getElementById('slater').style.left = MouseX - OffsetX;
-
-
if(document.getElementById('slater').style.left.replace("px","") <= 0) {
-
document.getElementById('slater').style.left = 0+"px";
-
} else if ((document.getElementById('slater').style.left.replace("px","")) >= 100) {
-
document.getElementById('slater').style.left = 100+"px";
-
}
-
-
var speed = document.getElementById('slater').style.left.replace("px","") / 10;
-
var fix_pt = (document.getElementById('slater').style.left != "0pt") ? speed : '0';
-
document.getElementById('speed').innerHTML = fix_pt;
-
}
-
}
-
-
function mouseMoveIE() {
-
MouseX = event.clientX;
-
if (MoveIT == "yes") {
-
document.getElementById('slater').style.left = MouseX - OffsetX;
-
-
if(document.getElementById('slater').style.left.replace("px","") <= 0) {
-
document.getElementById('slater').style.left = 0+"px";
-
} else if ((document.getElementById('slater').style.left.replace("px","")) >= 100) {
-
document.getElementById('slater').style.left = 100+"px";
-
}
-
-
var speed = document.getElementById('slater').style.left.replace("px","") / 10;
-
document.getElementById('speed').innerHTML = speed;
-
}
-
}
-
-
if (Browser == "IE") { document.onmousemove = mouseMoveIE; } else { document.onmousemove = mouseMoveFF; }
-
document.onmouseup = function () { MoveIT = ""; }
-
So like i sad before on ie it works but not on ff. I just cant find the bug
acoder 16,027
Recognized Expert Moderator MVP
Move the onmousedown in the slater div into an onload.
sorry did not understand can you show me an example?
acoder 16,027
Recognized Expert Moderator MVP
sorry did not understand can you show me an example?
For example: - window.onload=function() {
-
document.getElementById("slater").onmousedown=startDrag;
-
}
You could use addEventListene r/attachEvent instead.
-
window.onload = function() {
-
if (Browser == "IE") {
-
document.getElementById("slater").onmousemove = mouseMoveIE;
-
} else {
-
document.getElementById("slater").onmousemove = mouseMoveFF;
-
}
-
}
i did it like this bus it still is not working
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Akbar |
last post by:
Hey there,
Big-time curiosity issue here...
Here's the test code (it's not that long)... it's to display a large
number of image links with captions, ideally pulled in from an
external file (that part's not here -- spotlighting the problem code):
--------BEGIN CODE PAGE------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
by: Alan Silver |
last post by:
Hello,
I have read about the problems that IE has when using a doctype of HTML
4.01 Transitional. I was advised to use Strict wherever possible.
My question is, does the same apply to XHTML 1.0 Transitional? I develop
sites using ASP.NET, which emits valid XHTML 1.0 Transitional, but not
XHTML 1.0 Strict (for example, it includes a hidden form field with the
name of _VIEWSTATE, which isn't valid in Strict, but is in
Transitional).
|
by: Nathan Sokalski |
last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls
using the Add method of the Attributes collection. However, if the
JavaScript code contains certain characters, such as & or < or several
others, it converts them to html, such as & or < which can sometimes
cause my scripts not to work. How can I prevent ASP.NET from doing this?
Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
|
by: pamelafluente |
last post by:
I am trying to pass a javascript variable to ASP.
It almost works, except for the postback part. Infact if one clicks on
the div and on the button it can be seen that the variable passes
through. Can anyone help to do the postback?
Here is my complete code:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>
|
by: Rolf Welskes |
last post by:
Hello,
if I have for example:
<table style="width: 100%; height: 100%;" border="1">
<tr>
<td style="width: 100px">k
</td>
<td style="width: 100px">k
</td>
</tr>
| |
by: rampabbaraju |
last post by:
In my project I have two web pages with the same functionality, but the
controls are placed in different places in each page. Application
compiles and runs properly and produces the results I am expecting. But
the designer shows errors. Is it OK to do that way or not?
My two files are like this
Default.aspx-----
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
|
by: =?iso-8859-2?Q?K=F8i=B9tof_=AEelechovski?= |
last post by:
It is common knowledge that XHTML is better HTML and you can serve XHTML content as HTML.
However, the second statement is incorrect, for various reasons;
it is enough to say that the HTML validator does not tolerate XML-style empty tags.
It seems serving XHTML to the browser is of no advantage and can cause serious problems if the browser does not understand the difference.
This raises the question of downgrading XHTML to HTML.
I could...
|
by: pamela fluente |
last post by:
Hello, for the following code, VS suggests that construct (width=
height= ) is out of date and a newer one
is recommended:
<table><tr><td width="92" height="38" valign="middle">AnyThing</td></
tr></table>
Would you please tell me the right construct (clearly must be
functionally equivalent).
|
by: mideastgirl |
last post by:
I have recently been working on a website for an honors association, and have a lot of difficulty but have found help from those on this site. I would like to see if I can get some more help on a different issue than what I was initially having.
I am working on storing data collected from a form on my website. I would like the information to be stored into MySQL once entered by users. I have googled this question and have tried multiple...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |