Passing a function to Zorns tooltip

M

marcbinaus

HI,

I have this peice of code:
function showTooltip(elem)
{
var a = elem.form.elements['A1_1'].value;
var b = elem.form.elements['A1_2'].value;
var c = elem.form.elements['A1_3'].value;
var masterString = "123456789";
var notUsed = masterString.replace(a,'').replace(b,'').replace(c,'');
var notUsedArray = notUsed.split()
}

I'm using Walter Zorns tooltip from http://www.walterzorn.com and I
would like to pass the notUsedArray into the text field of the tooltip,
but this seems to be impossible.

I have this also
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

A1_4.Attributes.Add("onmouseover", "return
escape(showTooltip('A1_4'))")

End Sub

Can anybody help as I'm going mad trying to fix this???

Thanks in advance.
 
V

VK

I have this peice of code:
function showTooltip(elem)
{
var a = elem.form.elements['A1_1'].value;
var b = elem.form.elements['A1_2'].value;
var c = elem.form.elements['A1_3'].value;
var masterString = "123456789";
var notUsed = masterString.replace(a,'').replace(b,'').replace(c,'');
var notUsedArray = notUsed.split()
}

You cannot use split() w/o arguments: split over what? Not the most
effective but the most evident replacements would be:

// notUsedArray = notUsed.split() // not usable
var notUsedArray = [];
for (i=0; i<notUsed.length; i++) {
notUsedArray = notUsed.charAt(i);
}
}

I'm using Walter Zorns tooltip from http://www.walterzorn.com and I
would like to pass the notUsedArray into the text field of the tooltip,
but this seems to be impossible.

Then I'm not sure why do you need array if it becomes a string?
Aniway the code above gives you the needed array - serve it where you
have to, I'm not a WalterZone specialist :)
I have this also
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

A1_4.Attributes.Add("onmouseover", "return
escape(showTooltip('A1_4'))")

End Sub

Seems like VBA code. What is he doing here?
 
T

Thomas 'PointedEars' Lahn

VK wrote:

var notUsedArray = notUsed.split()
[....]

You cannot use split() w/o arguments: [...]

You can.

,-[ECMAScript 3 Final, 15.5.4.14 String.prototype.split (separator, limit)]
|
| [...]
| If `separator' is undefined, then the result array contains just
| one string, which is the `this` value (converted to a string).

Implemented in JavaScript 1.5/6 and JScript 5.6/6 (.NET):

<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:String:split>
<http://msdn.microsoft.com/library/en-us/jscript7/html/jsmthsplit.asp>


PointedEars
 
R

Randy Webb

VK said the following on 11/13/2005 5:07 PM:
I have this peice of code:
function showTooltip(elem)
{
var a = elem.form.elements['A1_1'].value;
var b = elem.form.elements['A1_2'].value;
var c = elem.form.elements['A1_3'].value;
var masterString = "123456789";
var notUsed = masterString.replace(a,'').replace(b,'').replace(c,'');
var notUsedArray = notUsed.split()
}


You cannot use split() w/o arguments: split over what? Not the most
effective but the most evident replacements would be:

// notUsedArray = notUsed.split() // not usable

It is very usable. Did you test it before you made the incorrect
assumption that you couldn't split without a parameter?
 
M

marcbinaus

Thank you for all the answers, and I do appreciate them, but the crux
of my problem is that I cannot pass a string from the function to the
tooltip.
I'm sure it's something simple but I can't see it in my head as I
understand VB but not java and I'm hoping to have this calculate
without having postbacks.

Thanks,

Marc

Randy said:
VK said the following on 11/13/2005 5:07 PM:
I have this peice of code:
function showTooltip(elem)
{
var a = elem.form.elements['A1_1'].value;
var b = elem.form.elements['A1_2'].value;
var c = elem.form.elements['A1_3'].value;
var masterString = "123456789";
var notUsed = masterString.replace(a,'').replace(b,'').replace(c,'');
var notUsedArray = notUsed.split()
}


You cannot use split() w/o arguments: split over what? Not the most
effective but the most evident replacements would be:

// notUsedArray = notUsed.split() // not usable

It is very usable. Did you test it before you made the incorrect
assumption that you couldn't split without a parameter?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top