Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 202 Vote(s) - 3.65 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I pass values from JS to JSCRIPT dynamicly (it drives me nuts)

#1
My home automation system only allows communication through JSCRIPT that runs on the SPS embedded IIS as ASP code. The old web interface was just on HTML and JSCRIPT. I need to move to HTML, CSS and JS with Bootstrap, but for data access I need to stick with JSCRIPT (ASP).
Reading data from asp variables is working easy, set it with a static value as well, **but to set asp variables through JS DYNAMICLY is where I struggle. **

I'd like something likd WritetoASP(A_Var, J_Var) where A_Var has the name of the ASP var and J_Var the value to be passed.

I'm sure that all the experts here do have a solution for me.


Here is a sample Code that shows the challenge.

```
<% @LANGUAGE="JSCRIPT"%>
<%
var A_Var=88;
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>ASP JS HTML Test</title>
<script runat="server" type="text/javascript">
var J_Var, Par="A_Var";
/* use the real asp variable name, returns the right ASP value */
J_Var = <%=A_Var %>;
document.write ('J_Var = '+J_Var+'<br>');
/* write a static value to the asp variable, writes the right value to ASP */
<%A_Var = 66;%>;
document.write ('A_Var = '+<%=A_Var%>+'<br>');
/* try to store and use the asp variable name in a JS variable, fails */
J_Var = <%="Par"%>;
document.write ('J_Var = '+J_Var+'<br>');
/* using eval to execute the asp command, fails */
J_Var = eval('<%="Par" %>');
document.write ('J_Var = '+J_Var+'<br>');
/* eval execute string generated in a variable, fails */
/* the replace is needed, otherwise JS interpretes the ASP tag */
Par="'Ü%="+Par+"%>'";
document.write ('Par = '+Par+'<br>');
J_Var = eval(Par.replace(/Ü/g,"<"));
document.write ('J_Var = '+J_Var+'<br>');
</script>
</head>
<body>
</body>
</html>

This is the result:
J_Var = 88
A_Var = 66
J_Var = A_Var
J_Var = A_Var
Par = 'Ü%=A_Var%>'
J_Var = <%=A_Var%>
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through