Wrox Home  
Search P2P Archive for: Go

  Return to Index  

beginning_javascript thread: RES: Re: RES: Re: ASP x JavaScript


Message #1 by "Elildo Mancebo Reis" <elildo@m...> on Thu, 17 Oct 2002 09:13:47 -0300
Because this hidden input field should have 'value=...' returned by the
document.write <resolution> :)))

-----Mensagem original-----
De: pgtips@m... [mailto:pgtips@m...]
Enviada em: quinta-feira, 17 de outubro de 2002 13:18
Para: Beginning JavaScript
Assunto: [beginning_javascript] Re: RES: Re: ASP x JavaScript


Why do you need to create them this way?  Why not just type them as
regular HTML?  No-one will see them coz they're hidden :-)

Phil
>---------------------------------
> Can I create an <input type=hidden...> using document.write ?

-----Mensagem original-----
De: pgtips@m... [mailto:pgtips@m...]
Enviada em: quinta-feira, 17 de outubro de 2002 12:50
Para: Beginning JavaScript
Assunto: [beginning_javascript] Re: ASP x JavaScript


If you want to create a session var, you'll have to POST or GET this data
to an asp page which then creates the session var.

Alternatively, you could use js to write a cookie and then use
request.cookies to get the info in asp.  Of course you'll have a problem
with your first page - until the js runs, the server won't know the screen
resolution, so what will you do?

Phil
>------------------------------------------------
I want help in order to combine a client side script and a server side
'decision'...

What I want is creating HTML based on user screen resolution. I will assume
only 800x600 and 1024x768.

So, is it possible to use something like...

<SCRIPT LANGUAGE="JavaScript">
	document.write(screen.width," x ",screen.height);
</SCRIPT>

to create an ASP Session Variable?

I just want to use this variable to offer a suitable design to users

Any idea?

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20

Message #2 by "Elildo Mancebo Reis" <elildo@m...> on Thu, 17 Oct 2002 09:25:34 -0300
That's it!!!

No problema about GET and POST, but I didn't know how to use js to create
it...

I understand I can use normal HTML

<form method=POST name=myform action=mypage.asp>
<input type=hidden name=scr_height> <!-- no value clause -->
</form>

Where do I must write the following javascript code?

<script language'javascript'>
  document.myform.scr_height.value = screen.height;
</script>

Thank you very much, PHIL, and I hope it's about to finish :)))




-----Mensagem original-----
De: pgtips@m... [mailto:pgtips@m...]
Enviada em: quinta-feira, 17 de outubro de 2002 13:17
Para: Beginning JavaScript
Assunto: [beginning_javascript] Re: RES: Re: ASP x JavaScript


Right, POST just means you have a form on an HTML page with method="POST"
and action="yourasppage.asp".  In that form you can put a few <input
type="hidden"> fields, say named (and id'ed) screenwidth and
screenheight.  Then in js you would do something like:
document.formname.screenwidth.value = screen.width;
document.formname.screenheight.value = screen.height;
document.formname.submit();
...
in yourasppage.asp you would have:
Session("ScreenWidth") = Request.Form("screenwidth")
Session("ScreenHeight") = Request.Form("screenheight")

then you have your session vars.

GET just means the form method="GET" and the values are appended to the
URL, so you have 2 choices:
1. as above for HTML/JS form and code, but in asp you use
Request.QueryString("screenwidth") instead of Request.Form("...

2. forget the HTML form entirely and do some JS like:
var sHref="yourasppage.asp?screenwidth=";
sHref+=screen.width; // you may have to parseInt this value
sHref+="&screenheight=";
sHref+=screen.height;
window.location.href=sHref;

Then in asp you use Request.QueryString again...

OK?
Phil
>-------------------------------------
> I've already thought about the first page. I could detect this and,
before
loading the entire page, create the session variable and refresh the page
by
redirecting to itself. Is it a good idea?

About POST and GET, I just wonder "how" :)) I'm not bad in ASP, but I
really
must be better than I am in JavaScript.

I appreciate your help...

-----Mensagem original-----
De: pgtips@m... [mailto:pgtips@m...]
Enviada em: quinta-feira, 17 de outubro de 2002 12:50
Para: Beginning JavaScript
Assunto: [beginning_javascript] Re: ASP x JavaScript


If you want to create a session var, you'll have to POST or GET this data
to an asp page which then creates the session var.

Alternatively, you could use js to write a cookie and then use
request.cookies to get the info in asp.  Of course you'll have a problem
with your first page - until the js runs, the server won't know the screen
resolution, so what will you do?

What if user changes screen resolution in-between pages?  What will you do
then?

Phil
>------------------------------------------------
I want help in order to combine a client side script and a server side
'decision'...

What I want is creating HTML based on user screen resolution. I will assume
only 800x600 and 1024x768.

So, is it possible to use something like...

<SCRIPT LANGUAGE="JavaScript">
	document.write(screen.width," x ",screen.height);
</SCRIPT>

to create an ASP Session Variable?

I just want to use this variable to offer a suitable design to users

Any idea?

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20

Message #3 by pgtips@m... on Thu, 17 Oct 2002 13:56:01
How about putting the js in the onload of the <body>?  Or sticking it 
right at the end of the html page?  Either should work.

Phil
>---------------------------------------
> That's it!!!

No problema about GET and POST, but I didn't know how to use js to create
it...

I understand I can use normal HTML

<form method=POST name=myform action=mypage.asp>
<input type=hidden name=scr_height> <!-- no value clause -->
</form>

Where do I must write the following javascript code?

<script language'javascript'>
  document.myform.scr_height.value = screen.height;
</script>

Thank you very much, PHIL, and I hope it's about to finish :)))




-----Mensagem original-----
De: pgtips@m... [mailto:pgtips@m...]
Enviada em: quinta-feira, 17 de outubro de 2002 13:17
Para: Beginning JavaScript
Assunto: [beginning_javascript] Re: RES: Re: ASP x JavaScript


Right, POST just means you have a form on an HTML page with method="POST"
and action="yourasppage.asp".  In that form you can put a few <input
type="hidden"> fields, say named (and id'ed) screenwidth and
screenheight.  Then in js you would do something like:
document.formname.screenwidth.value = screen.width;
document.formname.screenheight.value = screen.height;
document.formname.submit();
...
in yourasppage.asp you would have:
Session("ScreenWidth") = Request.Form("screenwidth")
Session("ScreenHeight") = Request.Form("screenheight")

then you have your session vars.

GET just means the form method="GET" and the values are appended to the
URL, so you have 2 choices:
1. as above for HTML/JS form and code, but in asp you use
Request.QueryString("screenwidth") instead of Request.Form("...

2. forget the HTML form entirely and do some JS like:
var sHref="yourasppage.asp?screenwidth=";
sHref+=screen.width; // you may have to parseInt this value
sHref+="&screenheight=";
sHref+=screen.height;
window.location.href=sHref;

Then in asp you use Request.QueryString again...

OK?
Phil
>-------------------------------------
> I've already thought about the first page. I could detect this and,
before
loading the entire page, create the session variable and refresh the page
by
redirecting to itself. Is it a good idea?

About POST and GET, I just wonder "how" :)) I'm not bad in ASP, but I
really
must be better than I am in JavaScript.

I appreciate your help...

-----Mensagem original-----
De: pgtips@m... [mailto:pgtips@m...]
Enviada em: quinta-feira, 17 de outubro de 2002 12:50
Para: Beginning JavaScript
Assunto: [beginning_javascript] Re: ASP x JavaScript


If you want to create a session var, you'll have to POST or GET this data
to an asp page which then creates the session var.

Alternatively, you could use js to write a cookie and then use
request.cookies to get the info in asp.  Of course you'll have a problem
with your first page - until the js runs, the server won't know the screen
resolution, so what will you do?

What if user changes screen resolution in-between pages?  What will you do
then?

Phil
>------------------------------------------------
I want help in order to combine a client side script and a server side
'decision'...

What I want is creating HTML based on user screen resolution. I will assume
only 800x600 and 1024x768.

So, is it possible to use something like...

<SCRIPT LANGUAGE="JavaScript">
	document.write(screen.width," x ",screen.height);
</SCRIPT>

to create an ASP Session Variable?

I just want to use this variable to offer a suitable design to users

Any idea?

  Return to Index