passing css to javascript

liunx

Guest
how can I pass the number 137 value to a javascript using css? Is this possible? The java will only take a number value at 137 position. This is for loading different style sheets for each screen resolution, the textboxwidth must change... What different varations I have tried doesnt pass anything...

layout-grid-line is the top to bottom, I need horizontal spacing.

Example;

.textboxwidth {
137
}



Javascript menu snip:

menu[0] = new Array();
menu[0][0] = new Menu(false, '', 3, 0, 20, '#CCFFFF', '#ffffff', '',

'itemText2');
menu[0][1] = new Item( 'Getting Around', '#', '', 137, 3, 1);


like so:

menu[0][1] = new Item( 'Getting Around', '#', '', 'textboxwidth', 3, 1);You cannot pass a number using CSS. It is not a programming language. Nor can you enter a value like you have shown.ranosb, what are you trying to do?would loading a different css based on screen resolution help?


<SCRIPT language="JavaScript">
<!--
if ((screen.width>=1024) && (screen.height>=768))
{
<!-- load high res css -->
document.write('<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"highres.css" title="style" />');
}
else
{
<!-- load low res css -->
document.write('<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"lowres.css" title="style" />');
}
//-->
</SCRIPT>What about someone with a 1024x768 or higher screen who has their browser displaying at below full screen size. Wouldn't it be bettwe to test the available size in the actual browser window rather than the screen size?Sure. I'm not sure what the requirements are. So i gave it a shot.You could change your code so that the menu itself has a class or id then set this width colours and all other styling properties using the CSS.
Maybe:menu[0] = new Array();
menu[0][0] = new Menu(false, '', 3, 0, 20, 'textboxdiv','itemText2');
menu[0][1] = new Item( 'Getting Around', '#', '', 3, 1);
...
.textboxdiv{
}?Yes, couldnt pass the variable with css, so Im using this...

else if (screen.width == 800) {
var menu0_1 = 110; var menu0_2 = 105;
var menu0_3 = 80; var menu0_4 = 110;
var menu0_5 = 110;

document.write doesnt work with Firefox nor does this; Everything on my website works with IE, but everybody says IE is no good!

else if (screen.width == 800) {
var ss = document.getElementById("s1024"); ss.disabled = true;
var ss = document.getElementById("s1280"); ss.disabled = true;

}document.write does work with firefoxIt does? So all my doc.write scripts that havent been working when I run FireFox is caused its not setup right?
Is that what your telling me?
 
Back
Top