473,396 Members | 1,767 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,396 software developers and data experts.

How to pass a value from an HTML hidden input to a JavaScript function?

Hi,

I need to pass a value from a hidden input:
<input id="hiddentxtWidth" type="hidden" value="1065" />
to a JavaScript function.

I've tried the following:
<script type="text/javascript" >
window.resizeTo(<%= hiddentxtWidth.value %>, <%=
hiddentxtHeight.value %>);
</script>

But I get a "The name 'hiddertxtWidth' does not exist in the current
context" error.

I would very much like to store the page width and height in the
Web.Config file and pass it to the JavaScript function but I don't
know how to do that.

Any suggestions?

May 15 '07 #1
3 3367

If you're doing this all clientside, then you're looking for

http://msdn2.microsoft.com/en-us/library/ms536437.aspx
function TestMe

{
var v=document.getElementById("hiddentxtWidth");
if (null!=v)
{
alert(v.value);
}
}
something like that. give it a try.

Use null checks to avoid a bunch of javascript errors.

"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@u30g2000hsc.googlegr oups.com...
Hi,

I need to pass a value from a hidden input:
<input id="hiddentxtWidth" type="hidden" value="1065" />
to a JavaScript function.

I've tried the following:
<script type="text/javascript" >
window.resizeTo(<%= hiddentxtWidth.value %>, <%=
hiddentxtHeight.value %>);
</script>

But I get a "The name 'hiddertxtWidth' does not exist in the current
context" error.

I would very much like to store the page width and height in the
Web.Config file and pass it to the JavaScript function but I don't
know how to do that.

Any suggestions?

May 15 '07 #2
Just type getElementById in google search and you'll see a bunch of
javascript links.

I don't know about using the web.config for holding window size information
but you can set session variables in the global.asax.
Then just grab session("elemW") if that's what you called it.
The syntax might not be exactly correct for grabbing the session variable,
but the concept is right.

"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@u30g2000hsc.googlegr oups.com...
Hi,

I need to pass a value from a hidden input:
<input id="hiddentxtWidth" type="hidden" value="1065" />
to a JavaScript function.

I've tried the following:
<script type="text/javascript" >
window.resizeTo(<%= hiddentxtWidth.value %>, <%=
hiddentxtHeight.value %>);
</script>

But I get a "The name 'hiddertxtWidth' does not exist in the current
context" error.

I would very much like to store the page width and height in the
Web.Config file and pass it to the JavaScript function but I don't
know how to do that.

Any suggestions?
May 15 '07 #3
How to Pass Messages and Actions between Server and Client
http://usableasp.net/DeveloperPage.a...rAndClient.htm

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@u30g2000hsc.googlegr oups.com...
Hi,

I need to pass a value from a hidden input:
<input id="hiddentxtWidth" type="hidden" value="1065" />
to a JavaScript function.

I've tried the following:
<script type="text/javascript" >
window.resizeTo(<%= hiddentxtWidth.value %>, <%=
hiddentxtHeight.value %>);
</script>

But I get a "The name 'hiddertxtWidth' does not exist in the current
context" error.

I would very much like to store the page width and height in the
Web.Config file and pass it to the JavaScript function but I don't
know how to do that.

Any suggestions?

May 16 '07 #4

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

Similar topics

7
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) ...
4
by: Fred | last post by:
Hi, i know how to pass a value from Javascript to ASP with a hidden field into a form and submitting it, or with cookies, but here i have to pass a lot of data in an array. There is a list of...
4
by: Amir | last post by:
Hi, I'd like to know if it's possible to pass an image name (the IMG SRC attribute) from HREF element to a function that is activated by onClick event and creates a Web page. I have this HREF...
1
by: platostoteles | last post by:
Hallo NG, I am new to JavaScript and would really appreciate any help to solve my problem. I am using the blow code in my form to validate form fields. What I would like to accomplish is that...
3
by: killafo | last post by:
ok so i have a whole bunch of rows that i get from a ResultSet. When i click on a td in a row i want to pass the date value of that row to a function. in IE7 i can get away with saying.... <td...
4
by: IRC | last post by:
hey, i am pretty new on javascript as well as PHP, Hey, anyone can you help me, how to pass the javascript array value to php page......... i want to retrieve the values which are arrayed on...
5
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio...
3
by: zac540 | last post by:
Hey everyone! First of all I'd like to say that I did my best to look for any other relevant posts. The best I found was this interesting thread.. http://bytes.com/forum/thread594982.html If...
5
by: montybytes | last post by:
Hi there, Although, I have already placed this question in the HTML/CSS section, perhaps it might be worthwhile asking the question here as well. I have a JavaScript function which retrieves...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.