PDA

View Full Version : organasing variables into hash



sanchopansa
12 Nov 2006, 03:27 AM
Hello,

I have this tooltip framework set up at http://www.proba45.free.bg (js folder for the problem) and want to change the variables format of the functions in sk_tooltips.js into hash, something like this:



var props= { obj : HTMLObject, //the object for which a tooltip will be displayed
text : stringText, //tooltip text
pos : positionHash //position hash (as it is now)
arrangement : tooltipDirection.LEFT //optional parameter for explicitly setting where the tooltip should be displayed. I would like to use predefined constants for the four directions.
width : intWidth //optional parameter for explicitly setting the width of the tooltip
};
DisplayInfoTooltip(props);


I've tried several variations of this and I always get an exception in FireBug saying


'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]"


for this code:



<html>
<head>
<title></title>
<script type="text/javascript">
var props = { obj : "",
text : "",
};
function show()
{ props.obj = this;
props.text = this.value;
alert(props.obj);
alert(props.text);
}
</script>
</head>
<body>
<form action="">
<input type='text' id='input1' value="Please, provide a valid email address." onclick="show();"/>
</form>
</body>
</html>


Would anyone care to take a look at the code an give me an example how to change the variable interface into hash? If anyone could give me a clue on how to organise the explicit arrangement of the tooltips with predefined constants I would be grateful, too.