How to give default value?

P

Paul

HI! I use iframes and I need to set a default value so if the user enters
the page directly he does not get an empty iframe.

I use this to query the var ( ifp )

<iframe src="<%=Request.QueryString("ifp")%>"></iframe>

Now should I set a session var so that the if the user enters the site he
will get whatever I set at the beginning of the users session?
OR
should I set an IF statement on the Iframe page.?

<SCRIPT language="JavaScript">
If (ifp==""){
ifp="default.htm"}
//--></SCRIPT>
 
S

Stefan B Rusynko

<iframe src="
<% IF Request.QueryString("ifp") <>"" Then %>
<%=Request.QueryString("ifp")%>
<% Else %>
<% ifp= "whatever" %>
<% End IF %>">
</iframe>

Where "whatever" can be as session variable or constant

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| HI! I use iframes and I need to set a default value so if the user enters
| the page directly he does not get an empty iframe.
|
| I use this to query the var ( ifp )
|
| <iframe src="<%=Request.QueryString("ifp")%>"></iframe>
|
| Now should I set a session var so that the if the user enters the site he
| will get whatever I set at the beginning of the users session?
| OR
| should I set an IF statement on the Iframe page.?
|
| <SCRIPT language="JavaScript">
| If (ifp==""){
| ifp="default.htm"}
| //--></SCRIPT>
|
|
| --
| Thanks in advance :)
|
| Paul
|
|
 
P

Paul

HI! I am still having problems, I use what you mentioned but It does not
accept the Iframe values that I give it.

<iframe src="<% IF Request.QueryString("ifp") <>"" Then %>
<%=Request.QueryString("ifp")%>
<% Else %>
<% ifp= "Template_Code_Files/All_featured_template_for_iframe.htm" %>
<% End IF %>">
name="Iframe001" width="750px" height="920px" scrolling="yes"
id="Iframe001">If you are reading this then your browser cannot view Iframe,
Please upgrade you borwser.</iframe>

The height and width and other params are not being used by the browser. and
it does not load the file that I specified either. Is there something else
missing here?

I tried it as writen above and on a single line.

NOTICE: If I just use the code below it works ( but it does not have a
default value at this point )

<iframe src="<%=Request.QueryString("ifp")%>" name="Iframe001" width="750px"
height="920px" scrolling="yes" id="Iframe001">If you are reading this then
your browser cannot view Iframe, Please upgrade you borwser. </iframe>

I use this from another page.
<a
href="mainpage.asp?ifp=Template_Code_Files/All_featured_template_for_iframe.htm">Click</a>

To use a default value should I define it as a session variable?
Is it possible to define the session var in the global.asa


Paul
 
C

clintonG

The reason it still doesn't work is because you attempted to populate the
ifp parameter of the QueryString using the conditional 'else' as if the ifp
parameter were actually a variable instead of a parameter of the QueryString
method which it actually is in the code as written.

The ifp parameter should be declared and initialized as a variable when
using it in this context. I haven't written ASP for awhile but its kinda
like riding a bike. So try this...

<%
' initialize ifp variable using QueryString value
dim ifp
ifp = Request.QueryString("ifp")

' if the ifp variable is not an empty string
if ifp <> "" then
%>

<!-- use value of ifp variable to initialize the iframe src attribute -->
<iframe src=<%= ifp %>

<% else %>

<!-- initialize iframe src attribute with default value
<iframe src="Template_Code_Files/All_featured_template_for_iframe.htm" >
<% end if %>

I don't want to write a tutorial regarding the difference betwen parameters,
values of parameters, and variables but this topic did keep me confused for
awhile when I started learning web developent. You should do some study on
the topic.

search: "using parameters"+"asp"

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/




Paul said:
HI! I am still having problems, I use what you mentioned but It does not
accept the Iframe values that I give it.

<iframe src="<% IF Request.QueryString("ifp") <>"" Then %>
<%=Request.QueryString("ifp")%>
<% Else %>
<% ifp= "Template_Code_Files/All_featured_template_for_iframe.htm" %>
<% End IF %>">
name="Iframe001" width="750px" height="920px" scrolling="yes"
id="Iframe001">If you are reading this then your browser cannot view
Iframe, Please upgrade you borwser.</iframe>

The height and width and other params are not being used by the browser.
and it does not load the file that I specified either. Is there something
else missing here?

I tried it as writen above and on a single line.

NOTICE: If I just use the code below it works ( but it does not have a
default value at this point )

<iframe src="<%=Request.QueryString("ifp")%>" name="Iframe001"
width="750px" height="920px" scrolling="yes" id="Iframe001">If you are
reading this then your browser cannot view Iframe, Please upgrade you
borwser. </iframe>

I use this from another page.
<a
href="mainpage.asp?ifp=Template_Code_Files/All_featured_template_for_iframe.htm">Click</a>

To use a default value should I define it as a session variable?
Is it possible to define the session var in the global.asa


Paul


Stefan B Rusynko said:
<iframe src="
<% IF Request.QueryString("ifp") <>"" Then %>
<%=Request.QueryString("ifp")%>
<% Else %>
<% ifp= "whatever" %>
<% End IF %>">
</iframe>

Where "whatever" can be as session variable or constant

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| HI! I use iframes and I need to set a default value so if the user
enters
| the page directly he does not get an empty iframe.
|
| I use this to query the var ( ifp )
|
| <iframe src="<%=Request.QueryString("ifp")%>"></iframe>
|
| Now should I set a session var so that the if the user enters the site
he
| will get whatever I set at the beginning of the users session?
| OR
| should I set an IF statement on the Iframe page.?
|
| <SCRIPT language="JavaScript">
| If (ifp==""){
| ifp="default.htm"}
| //--></SCRIPT>
|
|
| --
| Thanks in advance :)
|
| Paul
|
|
 
P

Paul

HI! Thanks, I will research this. I do find it a little confusing. I will
take notes of it as its easy to get mixed up between the two. I am still a
little lost. but thanks you for shedding light on it :)

Paul

clintonG said:
The reason it still doesn't work is because you attempted to populate the
ifp parameter of the QueryString using the conditional 'else' as if the
ifp parameter were actually a variable instead of a parameter of the
QueryString method which it actually is in the code as written.

The ifp parameter should be declared and initialized as a variable when
using it in this context. I haven't written ASP for awhile but its kinda
like riding a bike. So try this...

<%
' initialize ifp variable using QueryString value
dim ifp
ifp = Request.QueryString("ifp")

' if the ifp variable is not an empty string
if ifp <> "" then
%>

<!-- use value of ifp variable to initialize the iframe src attribute -->
<iframe src=<%= ifp %>

<% else %>

<!-- initialize iframe src attribute with default value
<iframe src="Template_Code_Files/All_featured_template_for_iframe.htm" >
<% end if %>

I don't want to write a tutorial regarding the difference betwen
parameters, values of parameters, and variables but this topic did keep me
confused for awhile when I started learning web developent. You should do
some study on the topic.

search: "using parameters"+"asp"

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/




Paul said:
HI! I am still having problems, I use what you mentioned but It does not
accept the Iframe values that I give it.

<iframe src="<% IF Request.QueryString("ifp") <>"" Then %>
<%=Request.QueryString("ifp")%>
<% Else %>
<% ifp= "Template_Code_Files/All_featured_template_for_iframe.htm" %>
<% End IF %>">
name="Iframe001" width="750px" height="920px" scrolling="yes"
id="Iframe001">If you are reading this then your browser cannot view
Iframe, Please upgrade you borwser.</iframe>

The height and width and other params are not being used by the browser.
and it does not load the file that I specified either. Is there something
else missing here?

I tried it as writen above and on a single line.

NOTICE: If I just use the code below it works ( but it does not have a
default value at this point )

<iframe src="<%=Request.QueryString("ifp")%>" name="Iframe001"
width="750px" height="920px" scrolling="yes" id="Iframe001">If you are
reading this then your browser cannot view Iframe, Please upgrade you
borwser. </iframe>

I use this from another page.
<a
href="mainpage.asp?ifp=Template_Code_Files/All_featured_template_for_iframe.htm">Click</a>

To use a default value should I define it as a session variable?
Is it possible to define the session var in the global.asa


Paul


Stefan B Rusynko said:
<iframe src="
<% IF Request.QueryString("ifp") <>"" Then %>
<%=Request.QueryString("ifp")%>
<% Else %>
<% ifp= "whatever" %>
<% End IF %>">
</iframe>

Where "whatever" can be as session variable or constant

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| HI! I use iframes and I need to set a default value so if the user
enters
| the page directly he does not get an empty iframe.
|
| I use this to query the var ( ifp )
|
| <iframe src="<%=Request.QueryString("ifp")%>"></iframe>
|
| Now should I set a session var so that the if the user enters the site
he
| will get whatever I set at the beginning of the users session?
| OR
| should I set an IF statement on the Iframe page.?
|
| <SCRIPT language="JavaScript">
| If (ifp==""){
| ifp="default.htm"}
| //--></SCRIPT>
|
|
| --
| Thanks in advance :)
|
| Paul
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top