trying to change the style using javascript

Hewlett-packard Pavilion dv6-2150us note...
March 28, 2010 at 10:38:34
Specs: Windows XP
Guys im trying to change the style using javascript here is what i did

var styleToSelect;
function onOk() {
document.getElementById('Paragraph1').className = styleToSelect;
document.getElementById('Applet').style.zIndex = 30;
}
function onLinkButtonClicked() {
document.getElementById('Applet').style.zIndex = -10;
document.getElementById('Applet').style.position = style = absolute;
}

Applet is a div that contains a java applet.


thanks


See More: trying to change the style using javascript

Report •


#1
March 28, 2010 at 11:14:48
Dunno, looks like it should work...what happens exactly?

Can you post the corresponding HTML as well??

Also, I would use jQuery, the syntax is much simpler, something like:

function onOk() {
$('#Paragraph1').addClass('styleToSelect');
$('#applet').css({ 'z-index' : '30'});
}
function onLinkButtonClicked() {
$('#applet').css({
'z-index':'-10',
'position':'absolute'
});
}

http://jquery.com/


Report •

#2
March 28, 2010 at 11:15:33
Oh, this line is wrong in yours:

document.getElementById('Applet').style.position = style = absolute;

Also - go install FireBug for firefox, it'll give you decent javascript debug messages so you can tell where the problem lies.


Report •
Related Solutions


Ask Question