Hello everybody,
Here is a little javascript that gives me the mouse's
x and y coordinates.
Now, i'd like to be able to make selection(s) rectangle(s)
on a given image with it.
And then, save the selection's specs.
For what i've seen by now: the major problem is the DOM compliant,
and browsers compatibility.
Could you please help/point me out doing it?
thanks in advance,
Thom.
//-------------------------
//The Code:
//-------------------------
<script type="text/javascript" language="javas cript">
<!--
function twPositionRelat ive(evt) {
var nOffsetX;
var nOffsetY;
evt = (evt) ? evt : ((window.event) ? window.event : "");
if (evt) {
if (document.all) {
nOffsetX = evt.offsetX;
nOffsetY = evt.offsetY;
}
else if (document.getEl ementById) {
nOffsetX = evt.pageX - document.getEle mentById("monIm age").offsetLef t;
nOffsetY = evt.pageY - document.getEle mentById("monIm age").offsetTop ;
}
document.getEle mentById("hTrac e").innerHTM L = "X : "+nOffsetX+ " ; Y :
"+nOffsetY;
}
}
function twInit() {
var oImage = document.getEle mentById("monIm age")
if (oImage) {
oImage.style.cu rsor = "crosshair"
oImage.onmousem ove = twPositionRelat ive
}
}
-->
</script>
Apr 22 '06
11 6768
thom wrote on 08 mei 2006 in comp.lang.javas cript: i hope u'll read this post today: your code is running like a charm if on a single page, but once you put it into a div, which you selected the style position, the selection rectangle are not on the picture anymore, say i click one point, the showing point is 100px left etc.. (doesn't match anymore). I know it is css, but wow, can't find a solution! Did you? or someone else?
To whom are you talking?
Wahat are you talking about?
Please always quote on usenet.
If you want to post a followup via groups.google.c om, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the article
headers.
<URL: http://www.safalra.com/special/googlegroupsreply/ >
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. a écrit : thom wrote on 08 mei 2006 in comp.lang.javas cript: i hope u'll read this post today: your code is running like a charm if on a single page, but once you put it into a div, which you selected the style position, the selection rectangle are not on the picture anymore, say i click one point, the showing point is 100px left etc.. (doesn't match anymore). I know it is css, but wow, can't find a solution! Did you? or someone else?
To whom are you talking? Wahat are you talking about?
Please always quote on usenet.
If you want to post a followup via groups.google.c om, don't use the "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers.
<URL: http://www.safalra.com/special/googlegroupsreply/ >
sorry, i thought you were still seeing former posts..
i am talking about this: http://stephane.moriaux.perso.wanado...uisse/thom.htm
problem comes when i put this everything into a div give it a place
on a webpage: the selection rectangle isn't synchronized, it doesn't
fit with the selection anymore.
it has to do with the "create selection" and the "lasso" functions...
and the x, y values.
thom. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Philippe Meunier |
last post by:
Hi,
I would like to know How I could draw a Dashed rectangle over everything in
a container. I will use this to draw a selection rectangle (like in VB.NET
Form Designer UI). And even it draws in invert colors I think, but this is
not necessary for now.
Can I do this with a usercontrol ? Because I know that transparency is a
little tricky in VB.NET, for usercontrols.
|
by: (Pete Cresswell) |
last post by:
I've got a TreeView on the left of my screen. As the user navigates the tree, I
load corresonding detail info into the rest of the screen.
Works ok, but when the user clicks on a detail field, the TreeView's selection
rectangle goes away and the user is left wondering what happened.
Seems like there ought TB a way to preserve that rectangle. The optimal would
be to have it go grey when the control loses focus and return to blue whe...
|
by: (Pete Cresswell) |
last post by:
Seems like I've been here before, but can't find anyting in Google.
I've got two list boxes on a form.
Seems to me like the inactive ListBox's selection rectangle should be something
like gray...otherwise, the user sees two ListBoxes, both with black selection
rectangles - and the user does not visually know which one he is "in". This
becomes relevant if we have a keyboard-type user - they want to hit "Enter" and
have something...
|
by: Jeroen Ceuppens |
last post by:
I need a selection tracker on a graphic
Idea:
left click: rectangle appear en grows when you move the mouse, again
clicking is lock te rectangle
How do you do that?
Greetz
Jeroen
|
by: TT (Tom Tempelaere) |
last post by:
Hi there,
In my application I have a panel that contains a matrix of user controls.
The user control is fairly simple. It merely draws a circle that represents
an object in my code. The object has certain properties that can be
configured, so each control has a context menu that allows such operations.
However, my application requires setting properties for multiple objects at
once. That would require being able to select multiple...
| |
by: Tyrant Mikey |
last post by:
I don't know if this can even be done, but I'd REALLY like to eliminate
the selection rectangle that appears around my ImageButton controls
when the user clicks on them. The buttons are on a black background,
and the selection rectangle looks like complete crap.
Any suggestions are greatly appreciated!!
Thanks!
|
by: Brian Henry |
last post by:
I am trying to do a owner drawn list view in detail mode, when i inherited
the list view into a new custom control then turned on double buffering all
the sudden the selection rectangle is the alpha channel transparent one that
windows xp's shell uses... is there any way to just keep the standard dotted
rectangle one? because performance is slow when the transparent rectangle
region is enabled with double buffering... but i cant find a way...
|
by: (PeteCresswell) |
last post by:
Got a TreeView control on the screen.
User clicks a node, screen loads details for that node.
Screen has two modes: Browse and Edit.
If the user clicks "Edit", I set Tree.Enabled=False and make the detail fields
on the screen editable.
Tree.Enabled=False because once the screen is in "Edit" mode for data behind a
|
by: Jure Bogataj |
last post by:
Hi all!
I have a problem (performance issue) with listview. I have implemented an
ItemSelectionChange on my listview and put some code in it (I build some
toolbar based on selection and update info in statusbar). When selecting one
item (clicking on listview) it works fast, without noticing. However if
selecting multiple items with SHIFT (approx. 500 items) or selecting with
mouse, for each item selected through all listview an event...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: 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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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...
| |