I've never had a problem with putting variables into the $() function

but I do have a suggestion for keeping your open/minimized/closed panels
straight

try declaring a global array or hash and using that as the status variable
- all the javascript functions can use it natively and you don't have to do
the expensive splitting every time you want to know what panels are open

example

var panels = new Hash({"system100" : "M", "system101":"U"}); //etc

//then

panels.get("system"+id);
//or
panels.set("system"+id,"U");

you can even initialize it easily

for(var t = 100 ; t <= 132 ; t++)
{
   panels.set("system"+t,"U");
}


Jason Westbrook | T: 313-799-3770 | [email protected]



On Mon, Oct 15, 2012 at 4:32 PM, Peter Sysko <[email protected]> wrote:

> Thanks for the suggestion, Jason. Most people don't run into this problem
> because they do not deal with dynamically assigned div ids from javascript
> variables. I found for what i am doing it was the most efficient way to go
> about referencing the divs. otherwise, switch statements with 33 cases
> would have to do, and that was pretty intensive.
>
> It does appear that the $(element) wrapper doesn't play nice at all with
> javascript variables, you actually have to put the quotes exactly as they
> appear on the div. (unless I am still doing it wrong).. i tried .toString
> functions, parseInt's, double quotes, single quotes, with and without the
> $wrapers, etc.. and finally I looked into the prototype.js script and the
> visible method is really simple, just checks if the display: property of
> the style attribute is set to none and returns a boolean value, so the
> workaround is to get the element with the document.getElementbyID (which*does
> *work fine with javasscript variable as the ID), and do the conditional
> statement custom. In the process of researching this bug I made a series of
> alternative functions as a different way to skin the cat. Currently they
> keep track of which systems are closed, minimized or unopen with some
> innerHTML in a hidden div that references the index (100-133) with the
> letter U, M or O, then rewrites the entire string when it changes.
> the initial div looks like this: (all systems unopened):
>
>
> <div id="mb_system_state_references"
> style="display:none;">100=U:101=U:102=U:103=U:104=U:105=U:106=U:107=U:108=U:109=U:110=U:111=U:112=U:113=U:114=U:115=U:116=U:117=U:118=U:119=U:120=U:121=U:122=U:123=U:124=U:125=U:126=U:127=U:128=U:129=U:130=U:131=U:132=U</div>
>
>
> I have got half of the functions working, you can see what I am working on
> here: http://monkeypanel.com/demo
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/prototype-scriptaculous/-/OHJUzayk4UAJ.
>
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to