Forum OpenACS Q&A: Javascript x TCL

Collapse
Posted by Iuri Sampaio on
I trying to create a function on TCL that works the same like one that i have in Javascript.
the one in javascript get the screen's width and choose the respective header

script language=JavaScript
////////////////////////////////////
// Resolution Definition //
////////////////////////////////////
if(screen.width==800){
resol=0
}else{
if(screen.width==1024){
resol=1
} else {
resol = (screen.width - 1024)/2
}
}
/script

*****************************

I believe the tcl function would be something like that:

set test [winfo width ]
if { [winfo width equal "1024"] } {
set show_header 0
} else {
set show_header 1
}

Does anyone know what the the tcl function to get the user screen's width??

Collapse
2: Re: Javascript x TCL (response to 1)
Posted by Nick Carroll on
winfo is a TK command. You'll only use this for desktop applications written in tcl/tk.

Furthermore, TCL runs on the server-side and javascript on the client-side. Therefore you'll be able to work out the screen width etc using javascript, but you won't be able to do so with TCL.