473,387 Members | 1,890 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,387 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 1518
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...

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.