webForumDet fria alternativet

Två lika if satser?

ASP

2 svar · 138 visningar · startad av Sammy

Medlem sedan maj 2000202 inlägg
Frågan#1

Kan man inte använda sig av två If.. then satser på raken?

\<%
 If IsNull(RStemp("MELLANRUBRIK")) then
  Response.Write ""
 Else
 Response.Write "\<B\>\<FONT size=2\>" & RStemp("MELLANRUBRIK") & "\</FONT\>\</B\>\<BR\>\<BR\>"
 End If
%\>

\<%
 'If IsNull(RStemp("INLEDNING")) then
 'Response.Write ""
 'Else
 Response.Write "\<B\>" & RStemp("INLEDNING") & "\</B\>\<BR\>\<BR\>"
 'End If
%\>

När jag inte har (värdet är tomt i databasen) en 'mellanrubrik' blir det ett stort glapp (dvs två <BR> )?

Varför?

------------------
/Sammy Swärd

Medlem sedan okt. 20005 273 inlägg
#2
If IsNull(RStemp("MELLANRUBRIK")) OR  RStemp("MELLANRUBRIK") = "" then
.....

denna kanske hjälper :)

------------------
Korvfarbror--Med ring på fingret

Medlem sedan maj 2000202 inlägg
#3

YES!

\<%
 If IsNull(RStemp("MELLANRUBRIK")) OR RStemp("MELLANRUBRIK") = "" then
  Response.Write ""
 Else
  Response.Write "\<B\>\<FONT size=2\>" & RStemp("MELLANRUBRIK") & "\</FONT\>\</B\>\<BR\>\<BR\>"
  Response.Write "\<B\>" & RStemp("INLEDNING") & "\</B\>\<BR\>\<BR\>"
 End If
%\>

Fick göra om lite (är nybörjare) men det fungerade! ;)

Tack så mycket!!!

------------------
/Sammy Swärd

264 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849
122 ms — deklarationer (db)
0 ms — hämta statistik (cache)
133 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)