The value that gets embedded is a session variable and it gets embedded as a literal string. So if hte value you are embedding is a string it will need the quotes around it. If it's a number of some sort then don't use the quotes around the evaluated expression...
You can look at the JavaScript generated once the page has rendered to see exactly what you end up with.
+++ Rick ---
>Rick, Thank you so much, works great. That's been killing me for 2 days. I hadn't been using the quotes. How do the quotes effect the value if it is numeric?
>I had to change the bracket to parens, syntax error.
>
>
>>You can't access < %= % > expressions in a separate file since the separate javascript file is not an ASPX/ASP page hence it doesn't evaluate that value.
>>
>>There are a few ways around this.
>>
>>One is you can set a global variable in your main ASPX/ASP file :
>>
>>< script type="text/javascript>
>>var sessionVar = "< %= Session["mySessionVar"] % >";
>>< /script>
>>
>>Put that on the bottom before the form tag of your main form and then in the .js file you should be able to reference sessionVar as a global variable.
>>
>>+++ Rick ---
>>
>>
>>>I have all my Javascript in a separate file linked to an html page. I am trying to get the session variable value from within a Javascript function. If the function code is on the html page it works, but it won't work in the linked file. I have written the value to the page with VBScript. I use a hidden text to pass to the Session variable. The Session variable has the correct value. Anyone know why I cannot get the Session variable value when the js code is in a linked file?
>>>Code sample below:
>>>
>>>// fills comboxbox for vendors
>>>function SelectVendor(classid) {
>>> var selCls = < %=Session("nSelCls")% >;
>>> if (selCls != 0){
>>> startForm.cboClasses.selectedIndex = selCls;
>>> classid=selCls;
>>> }
>>> var vendors=xmlClasses.childNodes(0).childNodes(classid);
>>> startForm.cboVendor.options.length=0;
>>> for (i=0;i<vendors.childNodes.length;i++) {
>>> oOption=document.createElement("OPTION");
>>> o=vendors.childNodes(i);
>>> new_option=o.getAttribute("vendor_name");
>>> oOption.text=new_option;
>>> oOption.value=new_option;
>>> startForm.cboVendor.options.add(oOption);
>>> }
>>> SelectPayType(classid,0);
>>>}
>>>