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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

include some asp within javascript 1

Status
Not open for further replies.

pandapark

Technical User
Jan 29, 2003
92
GB
Hi

I want to construct an if then else statement on a validate page. basically saying if th value of Section1_priority is 1 then alert with 1 message else alert with another message.
I presume I need to mix some ASP and Javascript

any help mych appreciated
ken
 
here is a way of doing :

<html>
<head>
<script language=javascript>
function fAlert(FLAG)
{
if (FLAG == 1) alert(&quot;Message 1&quot;);
else alert(&quot;Message 2&quot;);
}
</script>
</head>
<body OnLoad=&quot;fAlert(<%=YouASPVariable%>)&quot;>



</body>
</html>

another way :

<script language=javascript>
<% if YouASPVariable = 1 then %>
alert(&quot;message 1&quot;);
<% else %>
alert(&quot;message 2&quot;);
<% end if %>
</script>
 
hmmm - not a very clear question....
Is this what you need?

<%
if section1_priority = 1 then
mess = &quot;Section 1 is the priority&quot;
else
mess = &quot;No priority is set&quot;
end if
%>

<script>
if (&quot;<%=mess%>&quot; != &quot;&quot;){
alert (&quot;<%=mess%>&quot;)
}
</script> Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top