2014-09-05 3 views
0

이전에 한번도 해 본 적이없는 스크립트에 관해 질문이 있습니다. 동일한 스크립트에 포함 된 것처럼 보이는 두 개의 단추를 제거하려고합니다. body 태그 안에는 스크립트 내부의 내용을 제거하려고 시도 할 때 페이지가 중단됩니다. 그것에 관해 약간의 조사를하려고 노력했다. 그러나 어떤 운도. HTML 내의 버튼과 관련된 ASP 스크립트 태그

는 스크립트 섹션

HI 안에, 이것은이 나쁜 코드 body 태그

catid = Request.QueryString("id") 
sub productInfo(connObj,category) 

sqlCustomer = "SELECT * FROM qryProdsCategory WHERE ccategory = '" & Cint(category) & "'" 
Set rs = Server.CreateObject ("adodb.Recordset") 
rs.Open sqlCustomer, dbc, adOpenDynamic, adLockOptimistic, adCmdText 
if not rs.EOF then 
if Session("sort")="0" then 
rs.sort = "cname ASC" 
end if 

while not rs.EOF 

If rs("stock")="1" then 

Response.Write "<form action="&q&Application("secureurl")&"/cart/view-cart.asp"&q&"  method="&q&"POST"&q&" name=form"&i&">" 

Response.Write "<a href=""product.asp?id=" & rs("catalogID") & "" 

Response.Write "" & rs("catalogID") & "" & rs("manModNum") & "</font></td><td width=""18%"" rowspan=""2"">" 
Response.Write "<input type="&q&"hidden"&q&" name="&q&"fproductid"&q&" value="&q & rs("catalogID")& q&">" 
Response.Write "<input type="&q&"hidden"&q&" name="&q&"fquantity"&q&" value=1>" 
Response.Write "<input type="&q&"hidden"&q&" name="&q&"fcat"&q&" value=" & rs("ccategory") & ">" 

If rs("stock")="" then 
Response.Write "<button class=""btn"" TYPE=""btn"" style=""background-color: #cb0000;color: #fff;"">.</button> </form>" 
Else 
Response.Write "<button "">ADD</button></form>" 



End If 



End If 

rs.MoveNext 
wend 

else 
Response.Write "&nbsp;<P><Center><font size=""2""><h3>Sorry, but products information for the category you have chosen is not available at this moment. Please check back soon!</H3></font></center>" 
catname = "Error" 
end if 

end sub 
%> 

<!-- INSIDE BODY TAGS BELOW --> 

<!-- Start Profile --> 
<div class="span3"> 
<img src="img/team/profile1.jpg"> 
<div class="productSelection"> 
<div class="ProductTitle"> 
<strong style="font-size:16px;">LOREM IPSUM</strong> 
</div> 
<h6>LOREMIPSUM</h6> 
<h6>LOREM IPSUM</h6> 

<% 
call openConn() 
call productInfo(dbc,catid) 
%> 

</div> 
</div> 
<!-- End Profile --> 
+0

코드와 같이 보이게하려면 (정상 줄 바꿈이 있어야 함) 코드를 수정하고 '코드 샘플'을 사용하십시오. –

+0

안녕하세요, 실제로 표준 코드처럼 보이게하는 방법에 대해서는 잘 모르겠습니다. 게시 할 때마다 일반 단락으로 바뀝니다. 죄송합니다.이 사이트를 처음 사용합니다. –

+0

모든 코드 줄의 시작 부분에 네 칸을 사용하고 작성중인 상자 아래의 상자에서 어떻게 나타나는지 확인하십시오.
을 줄 바꿈에 사용할 수도 있습니다. 그리고 텍스트를 제거하십시오 : '! [Script inside Body] [1]' –

답변

0

의 내부 섹션입니다. 코드가 form 태그를 두 번 닫고 있습니다.

form 태그가 두 번 닫히거나 전혀 닫히지 않았기 때문에 Response.Write 문 중 하나가 다른 If 분기에 있어야한다고 생각하기 때문입니다.

'DONT TOUCH THESE BELOW 
If rs("stock")="" then 
    Response.Write "<button class=""btn"" TYPE=""btn"" style=""background-color: #cb0000;color: #fff;"">ADD TO CART</button> </form>" 
Else 
    Response.Write "<button "">ADD TO CART</button></form>" 
'DONT TOUCH THESE ABOVE 

End If 
+0

일단 그렇게하면 버튼이 사라집니다. Response.Write는 body 태그 내부의 스크립트에 첨부 된 것입니다. 이것은 그것이 나타나게 만드는 것입니다. 이것은 내가 혼란스러워하는 곳입니다. –

+0

그럼 나도 혼란스러워. 버튼을 없애기 위해 당신이 말하지 않았습니까? 또한, BTW,'버튼'은'typ' 속성을 가지고 있지 않습니다. 'type' 속성이 있고, 그 중 하나는'button' 속성입니다. –

+0

당신이 제거하라고 말하는 버튼과 관련된 스크립트로, 웹 사이트의 "장바구니에 추가"기능에 연결되는 두 개의 버튼이 필요합니다. 문제는 단 하나 대신 버튼 두 개가 있다는 것입니다. 나는 하나가 아닌 두 가지를 보여 주어야합니다. 혼란을 드려 죄송합니다. –

관련 문제