Forum Moderators: open

Message Too Old, No Replies

Varying Cell contents based on one session state change.

         

fototex

9:20 am on Dec 27, 2009 (gmt 0)

10+ Year Member



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

daveVk

10:52 am on Dec 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



var m = " <p align="center">
<font style="font-size: 8pt; font-weight: 700" face="arial">&nbsp;&nbsp;Username:</font>
...

needs to be

var m = '<p align="center">'
+ '<font ... </font>'
...

the quotes do not extend past newline and use single quote if string contains double quotes.

Consider having two div's in memberarea
div1 containing m string, visible then no user
div2 containing welcome, visible when div1 not

As for line number, if there as other files involved check 12xx in them, IE not good at reporting correct file.

fototex

7:21 pm on Dec 28, 2009 (gmt 0)

10+ Year Member



Thank you very much daveVk, worked great after this change!