如何在asp.net vb的隐藏字段中返回javascript函数值 [英] how to return javascript function value in the hidden field of asp.net vb

查看:122
本文介绍了如何在asp.net vb的隐藏字段中返回javascript函数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设这是我下面给出的javascript函数,它返回当前日期时间和一些带有它的字符串

我必须将该时间和返回状态存储为最大化或最小化。那么如何在vb.net中的代码隐藏文件中存储这个javascript函数的值

函数getWindowState()

{

var S = window.screenLeft;

if(typeof S ==='undefined')

{

S = window.screenX;

}

S = parseInt(S);

if(S <-4000)

{



var t = new Date();

var curtime = t.getHours()+:+ t.getMinutes()+:+ t.getSeconds();

返回最小化;

}

if(S> -8&& S< 1){

document.bgColor =#FFFFFF ;

返回最大化;

}




任何想法如何使用asp.net隐藏控件请参考函数并给出我一些解决方案请帮助

Suppose this is my javascript function given below which returns current date time and some string with it
and i have to store that time and the return state as in maximized or minimized. So how to store the value of this javascript function in code behind file in vb.net
function getWindowState()
{
var S = window.screenLeft;
if (typeof S === 'undefined')
{
S = window.screenX;
}
S = parseInt(S);
if (S < -4000)
{

var t=new Date();
var curtime = t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();
return "minimized";
}
if (S > -8 && S < 1) {
document.bgColor = "#FFFFFF";
return "maximized";
}


any idea how to do it with asp.net hidden control please refer the function and give me some solution please help

推荐答案

假设你有一个隐藏的字段:

suppose you have a hidden field:
<asp:hiddenfield id="HiddenFieldServerDateTime" runat="server" CssClass="SomeStyle" /></asp:hiddenfield>





您可以将值分配给此隐藏字段,如:



You can assign the value to this hidden field like:

#<%= HiddenFieldServerDateTime.ClientID%>)。val( )= 无论你想分配什么;
("#<%= HiddenFieldServerDateTime.ClientID %>").val()="whatever you want to assign";











OR

<pre lang="Javascript">


(#<% = HiddenFieldServerDateTime.ClientID %> )。val (VALU在这里);
< / pre >
("#<%= HiddenFieldServerDateTime.ClientID %>").val("value here"); </pre>





希望有所帮助:)



Hope it helps :)


这篇关于如何在asp.net vb的隐藏字段中返回javascript函数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆