Is it possible to assign javascript variables values to ASP?
e.g. How would I store the following JS variable as an ASP variable in VBScript?
<script type="text/javascript">
var intJavaScriptNumber = 25;
</script>
The problem is I've got about 50 of these variables on a page, and they all need to be used in a simple equation which slows the browser down. If I could get them all into ASP then I could process this server side much more comfortably.
I put in a request recently for a script which would return 9 random numbers between 1 and 30. I got a reply which gave me this script, which writes them out.
It works great, but in the loop that writes them out, instead I would like to assign each value to a variable, such as img1,img2,img3,img4, etc. in the for loop, is this possible, or should I write out 9 statement lines, each assigning a value to a variable. I intend to plug the values into a java applet which rotates images.
Come to think of it, I could just put each value of the array right into the img tag, no? <img src="images/<%=random_number(1)=>.jpg"> Code:
I am trying to embed JavaScript to an ASP page which will be executed on the server side and will send a HTTP request from the ASP Web server another remote server. Then I need to capture the remote server's response and save it as a string.
I have an asp page which I'm working on and its a mixture of VBscript and Javascript. What i am trying to do is pull data from a MySQL database using VBscript and the onchange event, then pass the information through to a javascript function.
At first i was able to do this writing the code into the page using VBscript and then use a javascript switch statement, But now i need to access this data dynamically on the fly. Can anyone help, or point me in the right direction of how to achive this?
I need to be able to access a value in a text field in my asp code. This needs to be done client-side, because reposting to the page would take way too long. I'm writing this page for one user so I can tell them what browser to use if need be. Code:
I am trying to implement a shopping cart type idea for my website, and am learning how to use a simple array to do this.
The array has 4 attributes per item, namely, ISBN, BookTitle, price, Quantity.
I have been practising creating and entering data into arrays etc. as i am not familiar with how arrays work within an ASP environment. Basically, i would like to know how to add to my existing array, and keep the existing data in the array as well!! Code:
<script language="VBScript" runat="Server"> Response.Write("Hello from VB<br/>") </script> <script language="JavaScript" runat="Server"> Response.Write('Hello from JS<br/>'); </script>
and run it, I get the following output: Quote: Hello from JS Hello from VB
As you can see, despite appearing later in the file, the JS is being executed before the VBS. How can I stop this happening? (I want to include a VBS file...)
I want to pull data from a number of tables, Categories, SubCategroies and then place into JavaScript drop downs and have the options in the second drop down change upon the selection from the 1st drop down. Is this possible.? How is it done..? Arrays..?
I am trying to call a javascript function from a vbscript function. The problem is it keeps saying variable not defined and it does not need to be defined. I need it to execute the javascript function when flagit = 6. Code:
<script language = "javascript"> function test1() { ------------ <%test()%> // fine and works well if there is no response.write() in test() as i know. } </script>
now the problem is that how can i call test1 within scriplets or within test().
It's a simple validation page and was working fine until i made some changes to the next page.
A regular form that calls a javascript function, but suddenly i javascript function does not execute anymore. i tried calling other functions but none of them works, but when i treid onSubmit("javascript:alert('some text')") it works fine.
I tried debugging it in dreamweaver and i get an regular expression missing error number 1005 on the last line of the javascript.. that is ....
how i can pass a variable from my JavaCsript function to my ASP function. I have a list from which I call a javascript function with onChange(javascript function). Inside that function, i want to pass a variable to an ASP function which will use it in a SQL query.
I have tried everything i can imagine but to no avail. If that is not possible does anyone know how i can accomplish this in another way? I mean. can i call the ASP function directly from my onChange(asp function)? Or does an onChange require a script?
I am using ASP to open a text file on the server and I want to pass variables to Javascript. Any suggestions?
For example - I have a text file on the server defining a set of pictures. I open the text file to retrieve the list of files. I want to pass the list of files to the Javascript which will then display the data on the client machine.
I have a web site completely developed with .html pages.
My affiliate and ecommerce system are written in asp, as is the only registration page (register.asp).
If an affiliate sends a visitors to our registration page and the user decides to browse the site before registering we lose track of the affiliate id variable..
..Is there a way to pass a (one) variable between the html pages as the visitor browses the html based site and then have it passed to the registration page (register.asp)?
Also is there a method to set a cookie that retains this variable, and have it set to a one week expiration so that when the visitor returns to the site the most recently refering affiliate gets credit.
If passing of the variable is possible with javascript, can the javascript automatically check for the existence of the aforementioned cookie?
I know you can enter asp variable values into javascript functions
javascript_function(<%=asp_variable%>);
But can it go the other way? Can I take results from a javascript function and use them to update an asp variable? I would like to do the updating inside the function because it will be an onclick function.
I have 1 large image and small 3 thumbnails. Whenever a user clicks a thumbnail, it swaps with the large image. This, of course, is very straight forward when just including the directory and filename of the image in the Javascript. However, my images are sourced from an Access database (using the directory path of the image as a text field). I would like to insert the ASP <%=rs(?FieldName?)%> or variable within the Javascript so that it pulls the images from the db. I have tried this but it does not work.
I guessing that it has something to do with conflict between client and server side coding. I have included a snippet of the code. There seems to be nothing amiss with the source code. Can you help?
//javascript function <script type="text/javascript" language="javascript"> function swapPhoto(photoSRC) { document.images.imgPhoto.src = photoSRC; //swap thumbnail pics with main pic } </script>
Is it possible to create a global variable from within a Sub so it is available to another function in the same web page?
I want to tap a database for information within a Sub procedure but end the Sub after assigning the values to global variables.
Simply defining the variables as global (outside the Sub) and setting them to empty strings does not do the trick. The variables don't persist after the Sub procedure is complete.
I'm hoping there is a way to do what I am trying. I have an asp page with 3 radio button choices. Depending on which radio button the user selects, I want to populate some drop down menus with different choices. I have the case statement for the drop down boxes. Problem is, the html value from the radio button isn't actually used until you submit the form, so the case statement isn't finding any information to use to populate the menus. Does that make sense? So is there a way to make the radio button selection an immediately usable variable on the same page?
I'm having an issue using a VBScript (client side) and ASP together.
Basically I have this piece of testing code (sampled from my site) where the "Order Total" is obtained from the server. In my code I just declare an "Order Total" server side variable and set it myself. Code:
I have a piece of vbscript that returns the user logged on to the machine. it is as follows:
<script language="vbscript"> Set WshNetwork = createObject("WScript.Network") stringUser = (WshNetwork.userName) 'store username in variable stringUser document.write("Username: " & stringUser) 'output value to web page </script>
Now I need to use the value of stringUser on other pages of my asp application for database queries, form values etc. I have tried to call stringUser from inside <%..........%>, but it doesn't recognize the variable. Everytime I try to output the value from wthin asp code, it just appears as blank space. Any ideas?
How do I go about calling a server-side vbscript within a client-side javascript function? What I have is a page heavy on the javascript that has a number of functions, one of which is to begin a visual countdown with an onclick and also open an asp page containing the server-side vbscript, which initiates a wake-on-lan call. I had no idea how to call the vbscript within the javascript function, so this is why I opted for the vbscript asp page "pop-up" via window.open. Code: