473,322 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Setting Focus to a position in a graphic

I have a image that has a number of mouseovers defined as areas within
the graphic. The graphic is a large map which scrolls even on a full
screen.

Here is what I am trying to do.

In a field when someone types a location, I would like to have the
javascipt set focus to that location in the graphic. Like jump to a
link, except that it is a jump to a x/y coord in a graphic.

Thanks in advance for any assistance.

TK

Jul 23 '05 #1
3 1514
knightowl wrote:
I have a image that has a number of mouseovers defined as areas within
the graphic. The graphic is a large map which scrolls even on a full
screen.

Here is what I am trying to do.

In a field when someone types a location, I would like to have the
javascipt set focus to that location in the graphic. Like jump to a
link, except that it is a jump to a x/y coord in a graphic.

Thanks in advance for any assistance.

TK


Hi,

I don't think that is normal use for focus().
But maybe it works. Maybe not.
Try it, but I wouldn't advise it.
Be sure to test it on a few popular browsers before shipping.

2 other things you could try to get the wanted behaviour:
1) Try to manipulate the scrollbars, at least that is what they are made
for, and JS can scroll them.

2) Try to use anchortags, and jump to them.
That is: name your <a name="pos12"></a>
or when you use an imagemap: name them in there.

Still a lot of coding (mapping) to do for you to make it work.

just my 2 cents.

Regards,
Erwin Moller

Jul 23 '05 #2
> 2 other things you could try to get the wanted behaviour:
1) Try to manipulate the scrollbars, at least that is what they are made for, and JS can scroll them.
I am not sure if I will know the context of the scolling that will be
needed, perhaps hit or miss given the differences in browsers, and how
they render.
2) Try to use anchortags, and jump to them.
That is: name your <a name="pos12"></a>
or when you use an imagemap: name them in there.


This seems very reasonable. I will have a java script generate all the
needed code from a database, so the number of entries doesn't matter to
me. Here is a code snippit I developed, but doesn't seem to do the
job.

<BODY ><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript1.2" src="overlib.js"></script>
<body>
<a href=#test>Jump to test</a>
<a href=#bad>Bad</a>
<IMG height=535 alt="" hspace=0 src="LocationsMap.jpg" width=500
useMap=#Map border=0>
<MAP name=Map>

<A name="bad">
<AREA onmouseover="overlib('Test Location',
CAPTION,'<center>another test line</center>')" onmouseout="nd();
return true;" shape=CIRCLE coords=94,258,13
href="/index.asp?ageID=9&LocationID=2">
</A>

</MAP>
<br>
<a name="test"> this si a test </a>

-----------------------------
In the above code I can hit the test anchor, however when I hit the
image anchor, it doesn't move to the right place. It moves all the way
to the right. Was this what you had in mind? and am I doing it
correctly.

Thanks

Jul 23 '05 #3
Hi,

Unfortunately I do not have the time to do it with an imagemap, but here
follows an example in plain HTML. (under)
knightowl wrote:
2 other things you could try to get the wanted behaviour:
1) Try to manipulate the scrollbars, at least that is what they are made
for, and JS can scroll them.


I am not sure if I will know the context of the scolling that will be
needed, perhaps hit or miss given the differences in browsers, and how
they render.
2) Try to use anchortags, and jump to them.
That is: name your <a name="pos12"></a>
or when you use an imagemap: name them in there.


This seems very reasonable. I will have a java script generate all the
needed code from a database, so the number of entries doesn't matter to
me. Here is a code snippit I developed, but doesn't seem to do the
job.

<BODY ><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript1.2" src="overlib.js"></script>
<body>
<a href=#test>Jump to test</a>
<a href=#bad>Bad</a>
<IMG height=535 alt="" hspace=0 src="LocationsMap.jpg" width=500
useMap=#Map border=0>
<MAP name=Map>

<A name="bad">
<AREA onmouseover="overlib('Test Location',
CAPTION,'<center>another test line</center>')" onmouseout="nd();
return true;" shape=CIRCLE coords=94,258,13
href="/index.asp?ageID=9&LocationID=2">
</A>

</MAP>


I think your map is defined wrong.

Check this site for examples:
http://www.december.com/html/demo/imagemap.html
<br>
<a name="test"> this si a test </a>

-----------------------------
In the above code I can hit the test anchor, however when I hit the
image anchor, it doesn't move to the right place. It moves all the way
to the right. Was this what you had in mind? and am I doing it
correctly.

Thanks

Works on Mozilla.
I think you can do the same with anchortags on an imagemap.

<html>
<body>
<table bgcolor="#CCFFCC" width=2000>
<tr>
<td align=left>
<a name="left">Left</a>
</td>
<td align=center>
<a name="center">center</a>
</td>
<td align=right>
<a name="right">right</a>
</td>
</tr>
</table>

<ul>
<li> Jump to <a href="#left">left</a>
<li> Jump to <a href="#center">center</a>
<li> Jump to <a href="#right">right</a>
</ul>

</body>
</html>

Good luck,

Regards,
Erwin Moller
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jesper Dannemamm | last post by:
Hi I am having trouble setting focus on I tried using this script in the usercontrol's page_load sub to set focus on a textbox with the ID = "user_name": Page.RegisterStartupScript("focus",...
20
by: Arne | last post by:
During testing <div style="overflow:auto;"> in CSS I noticed the mousewheel would work in Mozilla only after I made a <a href="#">some text</a> link and clicked on that, within the div. It...
0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
2
by: Mystery Man | last post by:
We have an MDI application that is not setting always setting focus to the newly corrected MDI. It is creating the form and it is the topmost but it does not have focus. The code we are using to...
2
by: Jesper | last post by:
Hi, I'm showing a usercontrol containing a textbox on the screen by clicking a notifyIcon in the taskpane. I use textBox.Focus() to set the focus for the texbox, and I also get a blinking...
3
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There...
4
by: Wayne Wengert | last post by:
How can I have the focus on a specific textbox when a page opens? In the old ASP pages I could use an onload directive in the <Body> element but that does not work on my aspx pages? Wayne
12
by: CLEAR-RCIC | last post by:
Hi, I'm having problems setting focus to a textbox on a web user contol on an asp.net web page. The following script works on normal asp.net pages: <script language="javascript"> function...
3
by: register_allocation | last post by:
I have a frameset where I call a JavaScript function in the onLoad method: .... <frameset cols="..." onLoad="setFn()"> ... <frame name="data_frame" ...> </frameset> In setFn, I am...
3
by: kelvin.koogan | last post by:
I have a number of controls on a tab page. I want to validate them all when the user tries to leave the tab. I then want to highlight the first control which fails validation. How can I do this? I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.