将JS变量值保存在PageMethod之前,然后使用它? [英] Save JS variable value before PageMethod and use it after?
问题描述
按照Mark的建议,我使用div(当然是css)创建了一个JS弹出窗口,该表有两行两列的表
As suggested by Mark, I created a JS popup using div (with css of course), with a table with two rows and two columns
<input id='jsconfirmleft' type='button' value='Standard' onclick='criarNota(1)' onfocus='if(this.blur)this.blur()'>"+
" "+
"<input id='jsconfirmright' type='button' value='Azul' onclick='criarNota(2)' onfocus='if(this.blur)this.blur()'>"+
" "+
.....
我的问题是:我通过criarNota传递的值(1,2 ...)我用这种方式进行管理
My problem is: the value I pass on criarNota (1,2 ...) i manage it this way
function criarNota(cor) { // cor e um inteiro
PageMethods.verID(result);
}
然后
and then
function result(id)
{
if(id == -2) // n sao permitidas mais notas
........
jQuery.fn.stickyNotes.createNote(id+1,HERE!!!!);
}
不要混淆verID是服务器端的两个功能,客户端端的两个功能.
问题是,我需要获取"cor"变量值以创建createNote函数.
在这种情况下,我该怎么做?唯一的解决方案是否可能是将"cor"值发送到服务器,然后再将其发送回客户端?我需要一个有效的解决方案,我想知道如何做到这一点:doh:
dont get confused verID are two functions one to server side other to client side.
The problem is, I need to get that ''cor'' variable value to createNote function.
Under this situation, how can I accomplish that? Is it possible that the only solution is to send the ''cor'' value to server and then send it back to client side ? I need an efficient solution, and I''m wondering how could I do that :doh:
推荐答案
"verID是服务器端和客户端的两个功能."
真是一团糟.使用不同的名称.
创建一个JavaScript变量来保存传递给criarNota函数的值,并在verID函数中读取它.概念并不难.
我确实希望您能尽快完成此项目,以便您可以花点时间真正学习自己的工作.
"verID are two functions one to server side other to client side."
This is a mess. Use different names.
Create a JavaScript variable to hold the value passed in to the criarNota function and read it in the verID function. It isn''t that difficult of a concept.
I do hope you finish this project soon so you can spend the time you should have to actually learn what you are doing.
var someVariable;
function criarNota(cor)
{
someVariable = cor;
PageMethods.verID(result);
}
function result(id)
{
if(id == -2)
........
jQuery.fn.stickyNotes.createNote(id+1, someVariable);
}
这篇关于将JS变量值保存在PageMethod之前,然后使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!