用参数传递解决window.open的session变量有时候丢掉的问题


open函数,放在
< head > </ head > 之间

< script language = " javascript " >
<!--  
 
function  openwindow(par,hang,lie,mterm,mweek,mlabname)
 {
    
var  pp,bhang,blie,req_week,req_term;
 pp
= par;
 bhang
= hang;
 blie
= lie;
 req_week
= mweek;
 req_term
= mterm;
 req_labname
= mlabname; window.open('iptinfo.asp ? qinqiu = ' + pp + ' & qhang = ' + bhang + ' & qlie = ' + blie + ' & req_week = ' + req_week + ' & req_term = ' + req_term + ' & req_labname = ' + req_labname,'请输入相关信息','height = 200 , width = 320 , top = 0 , left = 0 , toolbar = no, menubar = no, scrollbars = no, resizable = no,location = no, status = no')
    }
-->
</ script >  


函数的调用,放在你想到的地方,我这儿是用onclick触发调用

< a href = # onclick = openwindow(' <%= session( " teachername " ) %> ',' <%= (bhang + 2 ) / 4 %> ',' <%= blie - 1 %> ',' <%= lnd_term %> ',' <%= lnd_week %> ',' <%= sek_labname %> ') > 预约 </ a >

那么在iptinfo.asp里面就可以用request(“qinqiu“)获得session变量的值,其它参数一样,可由request得到,不过据说在参数传递时url不能超过255,我好像超过了也没出错提示:(

你可能感兴趣的:(window.open)