PDA

View Full Version : Varying Cell contents based on a single session state change.



foreigner737
12-27-2009, 10:31 AM
Hi friends,
What I have been trying to achieve is,

On my index.htm, I have a horizontal cell named "memberarea" which originally shows username & password input fields. After the user logs in, this area changes itself to a "Welcome Name, Lastname" field.

I want that this cell displays again the username and password input fields in case of the session of the user has expired.

I have tried it with the following code (within the Iframe in index.htm):
-----------------------------------------

<script>
if ("<%=session("LoginFirstName")%>" == "")
{
var m = " <p align="center">
<font style="font-size: 8pt; font-weight: 700" face="arial">&nbsp;&nbsp;Username:</font>
<span style="font-size: 1pt">
<input type="text" name="uid" id="uid" size="14" style="width: 65; height: 17; font-size: 8pt"></span><font face="arial" style="font-size: 8pt">
</font><font style="font-size: 8pt; font-weight: 700" face="arial">Password:</font><font face="arial" style="font-size: 8pt">
</font><span style="font-size: 1pt">
<input type="password" name="pwd" id="pwd" maxlength="10" size="14" style="width: 65; height: 17; font-size: 8pt"></span><span style="font-size: 1px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input type="submit" value="Enter" name="B1" style="width: 35; height: 17; font-size:9px" onclick="return login()">";

window.parent.document.getElementById('memberarea').innerHTML=m;
}
</script>
--------------------------------------------------

This code gives me the error that on the 12xx'the line (which does not exist-the whole code is 5xx lines). there is a ";" missing which I could not found.

Any ideas how to achieve this?

Thank you for your comments

Philip M
12-27-2009, 10:46 AM
Unmatched quotes.

var m = " <p align='center'> "


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

godofreality
12-27-2009, 04:59 PM
i am not so certain u can do this either i am pretty sure u need to get rid of all the new line stuff or your variable won't work



var m = ' <p align="center"> <font style="font-size: 8pt; font-weight: 700" face="arial">&nbsp;&nbsp;Username:</font> <span style="font-size: 1pt"> <input type="text" name="uid" id="uid" size="14" style="width: 65; height: 17; font-size: 8pt"></span><font face="arial" style="font-size: 8pt"> </font><font style="font-size: 8pt; font-weight: 700" face="arial">Password:</font><font face="arial" style="font-size: 8pt"> </font><span style="font-size: 1pt"> <input type="password" name="pwd" id="pwd" maxlength="10" size="14" style="width: 65; height: 17; font-size: 8pt"></span><span style="font-size: 1px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> <input type="submit" value="Enter" name="B1" style="width: 35; height: 17; font-size:9px" onclick="return login()">';

dan_brownie
12-27-2009, 05:18 PM
Is this horizontal cell the iframe?

As said above for a start var m can't be spread over multiple lines, and using double quotes to contain the string won't work without ommiting the double quotes inside.

The below with fix your string.


var m = '<p align="center"><font style="font-size: 8pt; font-weight: 700" face="arial">&nbsp;&nbsp;Username:</font><span style="font-size: 1pt"><input type="text" name="uid" id="uid" size="14" style="width: 65; height: 17; font-size: 8pt"></span><font face="arial" style="font-size: 8pt"></font><font style="font-size: 8pt; font-weight: 700" face="arial">Password:</font><font face="arial" style="font-size: 8pt"></font><span style="font-size: 1pt"><input type="password" name="pwd" id="pwd" maxlength="10" size="14" style="width: 65; height: 17; font-size: 8pt"></span><span style="font-size: 1px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><input type="submit" value="Enter" name="B1" style="width: 35; height: 17; font-size:9px" onclick="return login()">';

I'm unsure if you're wanting to update the whole iframe or just a part of the iframe. If you wish to change its contents then you should be using the following.

window['memberarea'].document.body.innerHTML = m;

foreigner737
12-28-2009, 08:21 PM
Thank you very much guys! Worked great after removing the double quotas and using 's and a "+" between each <>