PDA

View Full Version : no luck getting this to work; please help


tonywaria
06-21-2010, 03:34 PM
no luck getting this to work; please help
I have some code like this

alert($("\'" + "#" + m + "\'"));

$("\'" + "#" + m + "\'").css('display','inline');
// $("#ds4").css('display','inline');

leftval = getPosLeft(el);
$("\'" + "#" + m + "\'").css('left',leftval);
// $("#ds4").css('left',leftval);

heightval = getPosHeight(el);
$("\'" + "#" + m + "\'").css('top','heightval');
// $("#ds4").css('top','heightval');

m is being passed to javascript and its value is ds4. If I put it inside jquery selector it doesn't work.

What I'm trying to do is - make the div - ds4 - visible - when user points the mouse over it.

It works fine using the hardcoded values. Don't know why it doesn't work inside selector.

I would sincerely appreciate your help.
Thanks in advance
Tony

_Aerospace_Eng_
06-21-2010, 03:39 PM
Can you post the rest of your code please? A sample test page would help too.

tonywaria
06-21-2010, 06:56 PM
Here is rest of the code

HTML code ----

<div id = "d4" onmouseover = "show('d4','ds4',4);" class="menu">
Science Library Books
</div>

Javascript code ----

function show(el,m,idx) {
var popItem = $('m');
if (popItem) {
alert("inside if");
alert(popItem);
alert($("\'" + "#" + m + "\'"));

$("\'" + "#" + m + "\'").css('display','inline');
// $("#ds4").css('display','inline');

leftval = getPosLeft(el);
$("\'" + "#" + m + "\'").css('left',leftval);
// $("#ds4").css('left',leftval);

heightval = getPosHeight(el);
$("\'" + "#" + m + "\'").css('top','heightval');
// $("#ds4").css('top','heightval');
}
}

Much thanks in advance for your help
Tony

_Aerospace_Eng_
06-21-2010, 11:21 PM
You don't have ds4 in the code you posted. Where is the element with id="ds4"?

tonywaria
06-21-2010, 11:34 PM
Here is the piece of code with ds4

<div id = "ds4" class="submenu" style = "display:none">
<a href="javascript:void(0); onClick=physicsGetData();">Physics </a> <br />
<a href="javascript:void(0); onClick=chemistryGetData();">Chemistry </a> <br />
<a href="javascript:void(0); onClick=zoologyGetData();">Zoology </a> <br />
<a href="javascript:void(0); onClick=botanyGetData();">Botany </a> <br />
</div>


Much thanks for your help.
Tony