473,396 Members | 1,738 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,396 software developers and data experts.

Arrays on mouseover displayed in tooltip?

Hi,

I have 3 textboxes A B C
The user can only enter single digit numbers in the textboxes, and if
they hover over a blank textbox it would give them the options through
a tooltip of what numbers are left over.
For instance if A =1, tooltip over B & C would = "2,3,4,5,6,7,8,9"
and B = 4, tooltip over C= "2,3,5,6,7,8,9"

I worked out a solution in vb, but that needs page postbacks, and I
would like to move away from that and make it smoother

So, how do I:
Write an array in javascript and calculate what is misssing if the
mouse hovers over a blank textbox and transfer whats missing to a
tooltip?
I suppose it would share the same logic of a sodoku puzzle thinking
about it, but sadly its not as exciting as that.

Nov 3 '05 #1
3 2365
ma********@hotmail.com said the following on 11/3/2005 6:28 AM:
Hi,

I have 3 textboxes A B C
The user can only enter single digit numbers in the textboxes, and if
they hover over a blank textbox it would give them the options through
a tooltip of what numbers are left over.
hover over the textbox? Use the onFocus to make it show, the onBlur to
make it go away.
For instance if A =1, tooltip over B & C would = "2,3,4,5,6,7,8,9"
and B = 4, tooltip over C= "2,3,5,6,7,8,9"
onFocus="showTooltip(this)"

function showTooltip(elem){
var a = elem.form.elements['textbox1'].value;
var b = elem.form.elements['textbox2'].value;
var c = elem.form.elements['textbox3'].value;
var masterString = "0123456789";
var notUsed = masterString.replace(a,'').replace(b,'').replace(c ,'');
var notUsedArray = notUsed.split()
alert(notUsedArray)
//use the reference to elem to know where/which tooltip to display
//the results of notUsed
}
I worked out a solution in vb, but that needs page postbacks, and I
would like to move away from that and make it smoother
So, how do I:
Write an array in javascript and calculate what is misssing if the
mouse hovers over a blank textbox and transfer whats missing to a
tooltip?
Use a simple string, replace what is used so far with blank space, then
split it to get an Array.
I suppose it would share the same logic of a sodoku puzzle thinking
about it, but sadly its not as exciting as that.


What is a sodoku puzzle?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 3 '05 #2
Randy Webb wrote:
ma********@hotmail.com said the following on 11/3/2005 6:28 AM:
I suppose it would share the same logic of a sodoku puzzle thinking
about it, but sadly its not as exciting as that.


What is a sodoku puzzle?


http://en.wikipedia.org/wiki/Sudoku :)

-- David

Nov 3 '05 #3
Thanks for the answer, I have used your code and the following code:
<script type="text/javascript">

/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library
(www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source
code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] :
document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")?
document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="")
tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera?
ietruebody().clientWidth-event.clientX-offsetxpoint :
window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera?
ietruebody().clientHeight-event.clientY-offsetypoint :
window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of
the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie?
ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" :
window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is
positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie?
ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px"
: window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

</script>

and written this in the pageload
C.Attributes.Add("onMouseover", "ddrivetip(showTooltip(C,'yellow',
300)")

and it works great apart from I can't transfer the notUsedArray to
appear in the textbody.
Can you help?

Nov 4 '05 #4

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

Similar topics

1
by: Steve Chatham | last post by:
I am moving some reports generated from a traditional ASP page to asp dotnet. In doing so, I have a listbox with x number of items in there. I've been asked to change the names somewhat to...
3
by: seep | last post by:
Hi, I have a webform with a button. When the user moves their mouse over the button.. I would like to initiate a mouseover event that shows a small window with text.. The text will be populated...
2
by: Erik Cole | last post by:
There doesn't seem to be a mouseover event for the notifyicon, but I want to fire an event that shows the user an updated status message on mouseover...sort of like hovering over the network icon...
0
by: mscdex | last post by:
I have a tooltip control added to my form as well as a treeview control. By using a Microsoft KB article (http://support.microsoft.com/kb/319963) as a guide, I was able to add tooltip support for...
1
by: Robert T | last post by:
Hi I would like to change the title property(the hint displayed when you move over it) of an elements colour/and or text size. Is this possible Can I change the title property's (hint on...
4
by: ianyian | last post by:
Hi expert, i have a stupid question need to ask which abt the javascript, im doing some scripting for the web page project, i need a feature which when mouse-in , then need a "dialog" or i donnot...
1
by: Herman Walker | last post by:
I am creating single line table columns dynamacially in and ajax UpdatePanel with text results. The results really contains a bulk of data which i put in a tooltip. The problem is that when i...
1
by: Anjani222 | last post by:
When i Mouseover on the combobox in datagridview ,the very first time it is not showing the tooltip.It shows the tooltip if it is clicked second time and only for the items that are exceeding the...
1
by: dave345 | last post by:
This javascript issue is in an app using C# / .Net 2.0 running on XP. First post, please mention if I mess up any conventions of this forum. I’ve got a mouseover event that only works properly...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
agi2029
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,...

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.