Setup:
Check to see if a correct password has been entered;
If not, present a "Enter Password" button;
If password has been entered, do not show "Enter Password" button.Uses Javascript along with Activ Link system variable "##ENTERPASSWORD()"
(non-typical eBook, more of an application in an eBook)
I'm using CSS created buttons in a left-side frame, show content in a right-side frame.
When user clicks on a button to access a protected page, I'm prompting to buy and input the password given after the buy.
<li><a HREF="##ENTERPASSWORD()" target="ViewFrame">Enter Password</a></li>
(the <li>...</li> is the CSS coding for the button, defined in HEAD section)
Here's the code as implemented:
//--------------------------------------------------
<script type="text/javascript">
// 'iscorrectpassword' = 1, password has been correctly entered; 0, password has not been correctly entered.
//set "pass" to Activ Ebook system variable 'iscorrectpassword'
//if "pass" <> 0, do not display "Enter Password" button in navigation buttons area
// parsInt(...) changes text value returned by 'iscorrectpassword' to integer value for "if" check
var pass = window.external.ActivGet('{iscorrectpassword}') ;
var intpass = parseInt(pass);
if (intpass==0)
{
var src = "<li><a HREF='##ENTERPASSWORD()' target='ViewFrame'>Enter Password</a></li>";
document.write(src);
}
</script>
//--------------------------------------------------
// note use of single quotes inside variable "src"
(Edited by fatherunit at 3:04 pm on Mar. 18, 2011)