474,046 Members | 2,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="hiddentxtWi dth" 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 3394

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.getE lementById("hid dentxtWidth");
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.goo glegroups.com.. .
Hi,

I need to pass a value from a hidden input:
<input id="hiddentxtWi dth" 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.goo glegroups.com.. .
Hi,

I need to pass a value from a hidden input:
<input id="hiddentxtWi dth" 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.goo glegroups.com.. .
Hi,

I need to pass a value from a hidden input:
<input id="hiddentxtWi dth" 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
2834
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) My code is below. I am getting the following error "MyForm.oNetwork.Value is Null or is not an object". I'm struggling to diagnose what to do next. I'd very much appreciate some help Many thanks <HTML><BODY><FORM NAME="MyForm"...
4
5407
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 product the visitor can order by clicking one or more checkboxes. I made a form containing input with type "checkbox" like: <form> <input type="checkbox" name=ck id=ck
4
4950
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 element: <A HREF onClick="showLargePicture()"><IMG HEIGHT=25 SRC="test01.jpg"></A>
1
5948
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 if when the list/menu (attribute6) value is "Ja" then to make the TextField Pas Nr (attribute4) required. And if when the list/menu (attribute6) value is "Nee" to make the TextField Pas Nr (attribute4) not required.
3
3477
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 .....onclick="javascript:getIt(this.value) id="..." name="..."> Is there something specific that Firefox is looking for, because it gives me "underfined" (using FireFox 2.0.0.3). i'll post the revelant code: this is the TD i want to get the info...
4
4360
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 "selectedValues" from next page for php variable this is my javascript code saved on "sendValue.js" file, <script> function updateRecordEntry(requestValue){
5
14031
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 button? I searched a few things on Google but I find the javascript below most useful in my case but there is some problem that my code is not running: var test = document.getElementsByName("meal"); for (i = 0; i < test.length; i++) {
3
9880
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 it answered my question I am just to stupid to realize it I would like to apologize in advance. This is my very first attempt at using Javascript so any help at all is greatly appreciated. I read the W3Schools Tutorial on Javascript so that and some...
5
5501
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 the left-position of an Element. This JavaScript functions works in FF and IE7 but does not work in IE6, In IE6 it retrieves the wrong offsetLeft value. Having investigated the problem I noticed it had something to do with the margin-left and position...
0
10548
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10339
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12142
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11143
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10313
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6654
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5420
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3973
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.