Convert ASP Variable To Javascript Variable
How do I convert an ASP variable to a Javascript variable?
View RepliesHow do I convert an ASP variable to a Javascript variable?
View Repliesis there any way of passing a javascript variable over to a asp variable so
i can write it to my database.
I have a menu that I use on my Intranet app, and while I did try to replace
it recently, I ended up going back to it. It's built entirely with
javascript, and works great.
However, there are certain pages where I would like to be able to put an
item into a querystring for a link. That is, I might have a link which is
worded "Add to this ticket" and the hyperlink associated with that text is
along the lines of "addtoticket.asp?ticketid=1000"
I am not able to figure out how to have an ASP variable into a link built by
javascript. This is the main question. How can I have the ASP variable in a
javascript?
Because it's Inranet, I don't have the page to show you. However, I have
zipped up the two javascript files and placed them at
www.middletree.net/js.zip
Also, in this case, IE-specific code will not be a problem. 100% of users
are on IE5+
i have this in javascript
letter = String.fromCharCode("A".charCodeAt(0) + <%=x%>)
how do i create a asp variable from letter?
The problem I am having is that I have a js file; I import or refer to that file
<script type="text/javascript" language="JavaScript1.2" src="../JScript/pop_data.js"></script>
within the js file I create all of my menu's. Now I have a session variable set very early in the piece;
I want to see what the value of the seesion variable is in the javascript code to see if certain menu's should be setup or not. I have tried all sorts of variations of coding to see what the coding should be, and none seem to work. Code:
I have an asp page that is needing to validate data against database but to do so I need to pull in a key value from another web page. I can get the key value in ASP using the following javascript code:
<script>
var main = opener.opener;
var currQuote = main.document.forms[0].quotenum.value;
</script>
My problem is trying to figure out how to use currQuote in the ASP code surrounding the script. There's got to be a way to do it - I'm just burnt out trying to figure it out.
I'm trying to take an ASP session variable and pass it into a javascript function with little success. As the page loads, the session variable is there and the javascript function is called as an include.
I've tried silly ideas like option explicit and using asp to write the javascript declaration of the variable.
How do I display a javascript variable in asp code? Code:
View Replies View RelatedIf I assign VBScript server side variable a to javascript variable x, it is fine.
<%
Dim a, b
a = 10
%>
var x = <%= a %>;
alert(x);
But if I do the other way around, then it has 500 error. any ideas??
<% b %> = x;
Is it possible to read any ASP variable from a javascript file (.js) ?
View Replies View RelatedI have a session variable set on my main page which works fine, I also have a popup window called from a text link via javascript.
For some reason the session variable is not available on the popup window. Is this normal?
I have a search function that is reading companies from a database via
ASP and spitting out the results. I have various fields of each company
in variables and I want to be able to create a link that uses
Javascript to copy the address to the clipboard.
I know there is the javascript:window.clipboardData.getData(), but I
can't get to parse the ASP variable through. Does anyone know how I can
do this.
I'm trying to use a javascript function passing a vb variable. I don't understand why it doesn't work. Code:
View Replies View RelatedIs it possible to get an asp session variable within a javascript function?
View Replies View RelatedI have an input box when the user clicks on the button.
var number=prompt("enter journal number");
How is it possible to pass this variable forward but to vbscript? So i could use that variable in an sql procedure?
I'm turning my application into a "DLL". Everything worked fine untill I try to do a "While" in my asp code. Then I recieve an error like this:
"Object variable or With block variable not set"
My vb code look like this.....
How can i store the JavaScript "screen.width" variable as an ASP variable?
Or is there a VBScript ASP equivalent of:
<script language="JavaScript1.2">
var mywidth = screen.width;
document.write (mywidth);
</script>
?
sql = "SELECT * FROM & console &'news'"
I got that right now but i want the variable, console to be placed along with news so when it selects from the db it selects from gcnnews or whatever variable it's on. How do I do that?
im trying to subtart one quantity from another then stick the answer in to an update statment, but all i get is an error in syntax message
variable math bit=
qty=request.form("oqty")-Request.form("qty")
sql =
sSQL="Update spares SET spares.location='"&request("location")&_
"',spares.machine='"&request("machine")&_
"',spares.part_desc='"&request("part_desc")&_
"',spares.part_number='"&request("part_number")&_
"',spares.qty='(" & qty & ") "&_
"',spares.min_qty='"&request("min_qty")&_
"',spares.updated_by='"&session("name")&"' WHERE(spares.id)=" & form_id
I need to assign a value to a variable, but this variable name is dependant upon another variable!! I am including the code below so you can see it, cos if not I am sure you are thinking whattt?? Code:
View Replies View RelatedI have many buttons that mapping many textbox, when I click button, I
want to show a string that contains button number( and the mapping
string ), but it failed.
Here is the code:
/////////////////////////////////////////////////////////////////////
<%response.write"<input type='button' name="'btUS95resone"&" a &"'
value='Save' onclick='resone("&a&")'>"%>
function resone(cnt)
{
alert("document.all.txt_note"+cnt)
}
////////////////////////////////////////////////
It seems that the component I called is not there...
Can anybody tell me what is the asp equivalent of the php-phrase:
if (!$Variable) {}
?
Another question: is there a special syntaxis for asp conditions in condition?
I tried this code it doesn t work:
If Condition Then
If 2nd condition Then
ElseIf Then
End If
End If
And it works only when I remove the 2nd condition's End If and the ElseIf. Seems strange, no?
I have a text file that looks like this:
Artist Name: Kiss
Song Title: Rock and Roll All Night
Running Time: 04:38
And I need to be able to get the artist name and song title in asp and display it on a website. The thing is, the text file changes with the song being played on the radio. How can I do this?
I've been given an ASP app written with server side javascript. This app needs to get the username of the person currently logged in to windows (Request.ServerVariables("AUTH_USER") in vbscript). I found a way to get this variable in javascript, but then it wouldn't let me split it (server kept saying method not supported). So I've gave up on getting the username with javascript, and have set variables in VBscript at the top of my page. How do I access those variables within the javascript portion?
View Replies View Relatedi have a textbix name "building" inside my system where the user might input one or several building name in it seperated by a comma. How can i extract each of the value in it? For example, "PG2, PG7, PG6", i want to extract each of them.
View Replies View RelatedI have this url that loads, but in the url is the date, so I need a variable i can use so as the date changes the url is automatically updated,
View Replies View Relatedusing access db and asp
i have a variable from a form
sRound = request.form("round") and for now let us say this value is 3
now i want to include that 3 in sql, but it is part of a field name which
is round3_report
cm.CommandText ="UPDATE rounds SET round" & sRound & "_report = '" & var5 &
"' WHERE Name ='" & sName & "' AND meeting = " & var4 & ""
cm.execute
this isn't working. i keep getting parameter error. i know there is a way to
join a word with a variable in order to make a field name in asp/sql
I am having difficulty in displaying Response.Write rsVacancies("Title") variable more than once. If I remove it from the page title it displays within the description tag but does not display in both. Code:
View Replies View RelatedI am tring to search a database with an SQL statement via a web page. I am using Dreamweaver to build my page. The search works great when I hard code the table field into the Recordset. However, I would like to implement a variable on the field in the table to do the search on.
For Instance, a user can make a selection in a drop down box and then enter the text in a text field. I am having trouble implementing the drop down box variable into the code. I suspect I need the WHERE to be a variable just as the LIKE parameter but I keep getting errors. Code:
I have one condition for getting the image in an included file. If the file which is including the included file is from parent folder if should pull the image directly from Image folder, otherwise it should change the path like Code:
View Replies View RelatedI have created the pages for a website in HTML. I need a script in ASP that displayes the HTML pages when requested (EG: script.asp?page=HTMLpage1).
<html>
<head>
<title>Test site 1</title>
</head>
<body>
<% page = request("page")
select case page
case main: <!--#include file = "index.html"-->
case "services": <!--#include file = "services.html"-->
case "case_studies": <!--#include file = "case_studies.html"-->
end select
%>
</body>
</html>
Any ideas on how to make this work?
for example, if i have Code:
do while not c.eof
if c.fields("id")=request.cookies("id") then
response.write "This is you"
else
response.write "This is " & c.fields("name")
end if
c.movenext
loop
the request.cookies("id") does not work! no variable will work in its position, either. the 'if...then' statement above will only work with c.fields("id")="something", not a variable, like i want. how can i get around this?
I have a HTML-only file, and asp file that do a databasequery.How can I do a query in the html file, like this: DBLookup("2").The asp file execute the query and respond with the result. Send it back to the htmlfile and put it were the "DBLookup("2")" is.
I can not have any asp code in the html page.I have a php file that works like this, but how can I do the same with asp?