Solved

pass a query string on a buttonclick

Posted on 2001-09-14
6
203 Views
Last Modified: 2008-02-01
I have a query string and when i click a button, that query string should be passed as a URL for the next page in the same window... Using ......

Window.Location.href="asp1.asp?Title=<% =Request.QueryString("xyz") %>

This is an example of how i tried for a Title field from a database.

the error i encountered was "Unterminated String Constant"...

The eror code is 1033. I hope iam correct...If anyone can help me sure do mail me soon........


S.Ramanujam (ramanujam@clearexperts.com)clearExpertsSolutions (p) Ltd,
A3, "CEEBROS RANGAM",
No.11, Cenatoph Road,
Teynampet, Chennai - 18

Phone: +91-44-4334619(off)
       +91-44-4334634(off)
       +91-44-3722375(res)

0
Comment
Question by:ramanujamsampath
6 Comments
 
LVL 3

Expert Comment

by:bigbed
ID: 6482346
You have href="....
then you have another double-quoted string within it ("xyz"), and you don't have the terminating double-quote for the href attribute.

You need to escape the double-quotes in the QueryString("xyz") call, or use single-quotes there. And you need to add the closing double-quote.
Example using single-quote inside double-quotes (assuming single-quotes are legal in your ASP):
Window.Location.href="asp1.asp?Title=<% =Request.QueryString('xyz') %>"

0
 
LVL 5

Expert Comment

by:aryumin
ID: 6482364
Window.Location.href="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>
0
 
LVL 5

Expert Comment

by:aryumin
ID: 6482372
Oops. Forget a closing quote :(
Window.Location.href="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>";
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 50 total points
ID: 6482846
and to make it valid javascript you need to lowercase it and href is not needed to SET the url:
window.location="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>";

Michel
0
 

Author Comment

by:ramanujamsampath
ID: 6486651
Thanx a lot for a wonderful answer..... It really worked at the first trial itself...

Ai. Alevidae
Cheers

S.Ramanujam (ramanujam@clearexperts.com)clearExpertsSolutions (p) Ltd,
A3, "CEEBROS RANGAM",
No.11, Cenatoph Road,
Teynampet, Chennai - 18

Phone: +91-44-4334619(off)
       +91-44-4334634(off)
       +91-44-3722375(res)

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6486945
Sorry guys - just making a comment - not trying to poach the question

Michel
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now