Onclick Image Coordinates From Konqueror And Safari
Sep 26, 2005
I am trying to capture the image coordinates when a user clicks on an
image. My code is working in Firefox, Mozilla, Netscape, IE, and
Opera, but fails under Konqueror (and I suspect Safari). The code below
fails in Konqueror when the page is scrolled down; the coordinates are
off by the scroll amount.
My code in the html img tag: onClick="MLDot(event)"
The left frame has a DHTML-generated tree of links (to images). The right frame displays the image link you click in the tree of links.
It works great on all browsers except Konqueror/Safari, where it displays the first image link you click on in the tree of links. But then subsequent clicks on other links do nothing.
That is, the first time you click on a DHTML-generated link, Konqueror/Safari loads the corresponding image in the other frame. However, after that, when you click on links, the other frame is not updated.
I've been having an issue with Safari when it comes to getting mouse coordinates after clicking on an element - specifically the Y coordinate. For some reason, the 0 position is the bottom left corner of the window. The further down the page, the lower the number gets. This is crazy behavior - I have this stupid thing working in every other browser, but Safari.
My script is modeled after the standard Quirksmode script:
function doSomething(e) { var posx = 0; var posy = 0; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX + document.body.scrollLeft; posy = e.clientY + document.body.scrollTop; } // posx and posy contain the mouse position relative to the document // Do something with this information alert(posy); }
I have a simple problem: mark a list of defects on an image.
I think the best way to do it is to select a single deffect, then take two coordinates of coursor form an image on a web page (first when user press the button, and the second when he releases it). Those two points are going to be send to the web application (i.e. with AJAX) and saved in a database. Later, I will use those points to render the image with RMagic (drawing the lines and defects list numbers on top of the image).
Is there a way either in PHP or Javascript where the cooridinates of a requested image can be worked out? Let me explain - our members must have an image that is requested from our web server placed above the fold on their web site.
Instead of manually checking that the image is above the fold we would like our application that sends the image (written in PHP) or the Javascript on the members web page that calls the image each time th eweb page loads to tell us where the image will be placed on a web page. Is this possible?
set coordinates for an image I want to add to my page? I have the center coords where I want it to be places x is 400 and y is 90. I've searched all over the internet trying to find a solution.
i have to draw a line between to different coordinates which are going on google maps so for example :
[Code]...
the above coordinates are in xml format which, i later call in Java script functions and display them on the map as a simple pointers what i need is from one point of coordinates to another point of coordinates Java script would draw a line which would represent the direction from one coordinate to other .
point.x and point.y values get submitted to the server specifying where on the image I have clicked.
Is there any (simple) way to get ahold of that point.x and point.y BEFORE they are sent to the server (and prevent that from happening)? Ie. I just want the points where someone clicks on an image and not interested in a submission to the server.
i have a circular image... with pie shaped areas. i would like to use some form of jQuery and either a popup or tool tip that is CSS customizable... i looked at maphilight in the jquery plugins, but i dont see how you can make a pop up with that. unless there is another method i should go about doing this..
I need to restrict an area on the image but also get the coordinates from the image. I am using a form element "input type=image" so I can get the X Y coordinates from an image. I don't want the user clicking on a whole image, in this case a map of a country. I don't want the users clicking off the country's borders in to another country and I want to be able to get the coordinates from inside the country. I have tried to mix the element from the form with the area shape so when someone will click on the image it will first verify if it's over the hotspot and if it's over the poly coords then it will allow the user to click, the form will submit and the coordinates will be stored into the database.
I just don't know how I could integrate javascript into this. This is my code, not really something functional, the coordinates will pass on to the next page as a variable but limiting the area where the users may click is something that I have not figured out. I can create an area shape but without getting the coordinates from the image. Anything will do, even without <input type=image , if there is some way around this so I can make this work.
I have a page with a large centre-aligned image on it. I want a functionality whereby users can click their mouse on any point in this image and it would then show a virtual mouse pointer at the place where they clicked it. If they were to click somewhere else, the position of the virtual cursor would change.
The position of the cursor needs to dynamically generate a link and display it in a form field text edit box.
If that link is then viewed separately, it would launch the same page with the virtual mouse pointer at the location where the original person placed it.
Basically I want to be able to have one guy point to a location on the image for the benefit of another guy, but graphically as opposed to relying on written explanation.
I have a form that has a Javascript function being called when a button is clicked. The function works properly in every browser except Safari and IE 5.2 for Mac. Any ideas?
I have written a PHP script for a secure client login system and it is working on Firefox and Chrome. But it doesn't work on Safari and IE. I have noticed that some of the javascript functions do not work at all while a few of them work.I am pasting the part of my code that does't work up here:
<script type="text/javascript"> function newdir(i) {
[code]....
When I click on the create folder button (newdir.png), I don't see the alert message that I gave for debugging. I have the SAME problem with 2 more buttons on the same page.
I am trying to use AJAX to do a simple thing of displaying the results in the same page. Clicking on the <a href tag should display the results in the same page. This is working correctly in IE but the onclick() function is not working in firefox and safari.
I have a form that is shown depending on some criteria. If the criteria are met, I use innerHTML to swap it in. When a button is pressed, the info on the form is checked with javascript - if it passes the check I use innerHTML again to change the button to '...'.
This works fine on Firefox and Safari - the problem is that it doesn't work when I test it with my iPad (iOS 4.3). The button stays the exact same and the javascript seems to stall on the line where I execute the innerHTML. Up to this point, innerHTML on mobile Safari seemed to work the exact same way as MacOS Safari. On my iPad, the innerHTML swaps out this button if the event is triggered from a different button, but not from id="submitbutton" itself.I tested another method - disabling the button. Same issue - works on MacOS Safari/Firefox but not on mobile Safari on my iPad when using onClick from itself.
code snippets Form (it is a string since using innerHTML=) ...form content... <div id="submitarea" class="center">
I've spend about 2 days writing this javascript code and it works great in IE only to find out that it does nothing in Safari/FF.
Here is my code:
<script type="text/javascript">function calculate() { var thetotal = 0; var silver = 0; var gold = 0;
[Code]....
Basicly what the script does is using some variables in my form will calculate a total price in real time when you click the "Calculate" button. Works great in IE, but in Firefox/Safari it won't do a thing..
I discover a strange bug in Konqueror 3.1.1. I design a javascript application which acts in one file called example.html. At the beggining of this js i write:
if (document.images) { folderopen= new Image(16,16); folderopen.src="http://www.sergioamo.8m.com/buttons/folder_open.png"; folderclose= new Image(16,16); folderclose.src="http://www.sergioamo.8m.com/buttons/folder_close.png"; } functions.... .... ... .. and my javascript works perfect. If i write:
if (document.images) { folderopen= new Image(16,16); folderopen.src="./buttons/folder_open.png"; folderclose= new Image(16,16); folderclose.src="./buttons/folder_close.png"; } functions... .... ... .. my javascript does not work properly. Does anyone knows if is imposible to use relative references with konqueror 3.1.1 or which is the problem?
I am creating a chat script that uses PHP and Javascript. For part of it I need to empty one of the text boxes. The scripts I use work fine in IE and Firefox, however the the text box will not clear in Opera and Konqueror. I have tried the follwoing: document.getElementById('commentbox').innerHTML = '' and document.chatform.comment.value = "";
Like I said they are both fine in IE and Firefox, but not in Konqueror or Opera. I have searched for hours looking for code that will work.
I have a site which displays a selection of advert listings. We log the number of clicks each advert receives via ajax requests.The listings link to both internal pages on our site and external pages, hence the ajax - we cannot log the'clicks' by logging the requests on the destination pages as these are not all on our site for us to log. Also, I don't want to potentially get false positives e.g.from bookmarked pages - hence I am logging the actual clicks, not the requests on the destination.
All is OK in most browsers, but there is a problem with Safari (I am running Safari 4.0 on Windows XP running in Virtualbox OSE) but only where the destination is to open in the same window/tab (some listings go to a new window, some don't). I am logging clicks via an ajax request in the onclick event, which is working fine when the listing is to open in a new window, but it appears that when a new window is not to be opened, the ajax never gets sent.A have constructed the following minimal test case:
index.html
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" [code].....
Note the line commented '****' in index.html which cancels the action of the link. When this is not commented out, the ajax request is sent correctly. Without it (the desired situation) the ajax request never gets sent. Its as if Safari saves up the ajax requests to do later, but never sends them as the new page cancels all such 'saved up' actions.I am using the Safari web developer tools, but I have also checked this test case by checking the Apache logs. Note that as a test case I don't pretend that it will work in IE, but it should work in standards compliant browsers and has been tested on Firefox 3.6.6 and Opera 10.6. The Apache logs show that logger.txt is being requested, unless it is already in the browser cache.Possible workarounds I've considered, but would prefer to avoid:
On the site in question the only such links that currently open in the same window are internal, so I do have the option of logging safari clicks by logging these requests as opposed to clicks and checking the http referer on the server side. As this is not a very flexible solution as it relies on these specific circumstances, also relies on all other links successfully making a new window, and furthermore relying on http referer could result in false negatives I'd rather find a solution within the javascript.I haven't checked whether an asynchonous request would work, but I don't wish to do this anyway just in case there is ever a server problem that prevents the response coming back (note that for these purposes the response is actually superfluous - we are sending the server a message but don't need anything back). I also want to avoid the delay in sending the user to the destination - there is no point having to wait for a response we don't need.Lastly, and my prefered workaround unless I can find anything better, is to make Safari (only) open all links in a new window anyway.
Is there an equivalent in Konqueror's KJS engine to Gecko's __defineGetter__() and __defineSetter__() methods? Our web application uses a ton of Javascript, written based on Internet Explorer's object model as that's the primary platform that we're supporting. For Netscape support we uses __defineGetter__() and __defineSetter__() to emulate the many IE-only properties. I've tested our site using Safari, and to my surprise, it renders perfectly. Alas, it's completely non-functional. If it's somehow possible, I'd love to write a similar emulation library for KJS so that our non-Windows users would have an alternative to crummy Netscape/Mozilla.
I dymically replace the child nodes of a DIV element by image nodes. In IE and Firefox this works properly. In Safari it works properly, too - but only if the site is called locally, eg. with file://. Uploading to a server and viewing the site in Safari with http:// results in an error.
The problematic code is the following:
var node = document.createElement("img"); node.setAttribute("src", filename); node.setAttribute("style", "position:absolute;left:100px;");// error document.getElementById(name+"Images").appendChild(node);
When executing this script on Safari in online mode (again: with a _local_ file, it works fine!), Safari reports the following error, occuring in the marked line:
"[592] :TypeError - No default value"
Obviously, node.style seems not available at this point. I think Safari's still loading the image, and while loading it blocks all accesses to node.
Is this assumption correct?
That would mean that in Safari, I cannot do _anything_ with the image node until the image is loaded. These are not really bright prospects.