Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2009
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Varying Cell contents based on a single session state change.

    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

  2. #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    19,543
    Thanks
    221
    Thanked 2,712 Times in 2,686 Posts
    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.

  3. #3
    Regular Coder godofreality's Avatar
    Join Date
    Jan 2009
    Posts
    234
    Thanks
    1
    Thanked 15 Times in 15 Posts
    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

    Code:
    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()">';
    woot found the avatar options...i swear they didn't exist b4

  4. #4
    New Coder
    Join Date
    Dec 2009
    Location
    Oxford, England
    Posts
    26
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.

    Code:
    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;

  5. #5
    New Coder
    Join Date
    Jul 2009
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much guys! Worked great after removing the double quotas and using 's and a "+" between each <>


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •