Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Write partail output of string

Status
Not open for further replies.

JonathanG6SWJ

Programmer
Joined
Jan 18, 2005
Messages
39
Location
GB
I'm stuck again with my favourite command 'Response.Write'

My Code
<%
Dim txtA1Grade
txtA1Grade="Do Not Know"
Response.Write ("<input name=QA1 type=radio value=2 onClick=J(this.name,this.title) title=" & txtA1grade &">")
%>

Whilst I can test the length of txtA1Grade resulting in 11
chars my output stumbles when it hits the first space so I get "DO instead of "DO NOT KNOW".

Guess its something real obvious.
Thanks in advance
Jonathan


 
Maybe it's too early in the morning, but I'm not sure what your asking for. Please clarify.
 
because a space is a delimiter in HTML the title attribute has to be enclosed in quotes, as should ALL attributes for an element. Your code is (strictly speaking) invalid markup.

so it should be
Code:
<%
Dim txtA1Grade
txtA1Grade="Do Not Know"
%>
<input name="QA1" type="radio" value="2" onClick="J(this.name,this.title)" title="<%=txtA1grade%>">

Because of the way that the server pre-evaluates an ASP page it is more efficient to drop in and out of HTML than it is to response.write the HTML into the page stream.



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top