473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Javascript variable in asp.net (screen resolution)

Frens,

I am trying to get screen resolution of the client machine using
javascript and use those values in my project. I looked at some of the
examples given .net groups, i tried to implement the same but everytime
i get nulls, i tested javascript by keeping alert statements
and everything looks good to me.... I am trying to figure it out what
peice of info is missing in this code.....

Here is my code

In PageLoad....
===========
If (Not IsPostBack) Then
RegisterStartupScript("MyScript", _
"<script language=javascript>" & _
"document.forms['Form1'].submit();</script>")
Else
Dim resW As String = Request.Form("resW")
Dim resH As String = Request.Form("resH")
End If
In ASPX page
==========
<HTML>
<HEAD>
<script language="javascript">
document.getElementsByName('resW').value = screen.width;
document.getElementsByName('resH').value = screen.height;
</script>

</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<INPUT id="resW" type="hidden" name="resW" runat="server">
<INPUT id="resH" type="hidden" name="resH" runat="server">
</form>
</body>
</HTML>
referred to :
<http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/7e8a1109b11b83a3/19a7705d4458e6e6?lnk=st&q=getting+Javascript+value s+in+ASP.NET&rnum=11&hl=en#19a7705d4458e6e6>

Dec 27 '06 #1
0 1079

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jay | last post by:
Hi everybody !! I am just wondering if Javascript and PHP can interact with each other ? Let's say i have a variable in Javascript ( call it "var x = 6;") Is there anyway that we can use "x"...
2
by: Ang Talunin | last post by:
Hey, How to do something like this: <head> <style> img { width: <script>blaat();</script>;} </style> <script> function blaat()
8
by: Victor | last post by:
I need a JavaScript timer - I have five events I need to time, that can be triggered by a mouseclick event, or a keypress event. Each event is separated by only one to two seconds. The first...
3
by: mbasil7 | last post by:
Hi at all! I want to use a javascript variable in php. The reason is that i want to know the client's screen resolution. Keep in mind that i am not a javascript programmer but php. Here is...
14
by: Seige | last post by:
Ever had headache when you can't resize the background width using CSS: body{ background: url(/images/bg.jpg) ; background-width: 800px; } It won't work, would it? Of course not, it's not even...
7
by: Norman Swartz | last post by:
I want to place some graphic images on the web that are optimally viewed at a resolution of 1024 by 768 pixels. Is it possible, within Javascript,to force a particular screen resolution?
19
by: mantrid | last post by:
I have the following link to bring up an alert with a figure in it based on the screen resolution. but instead of displaying a number 'NaN' is displayed. <a href="javascript:alert('Your ideal...
11
by: srini | last post by:
Frens, I am trying to get screen resolution of the client machine using javascript and use those values in my project. I looked at some of the examples given in this group, i tried to implement...
7
crystal2005
by: crystal2005 | last post by:
Hi all, I'm currenty creating a website. I got one confusing problem related to CSS and JavaScript actually, not really html. The problem is, I actually want my welcome screen page is to be random...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.