0

i'm stuck in a problem with a script js. This is the condition:

var stampProd = "?php $stampProd = '10001'; ?";

function valiAnswPos(){

                if (document.getElementById("positive").checked = true)
    {
    document.getElementById('add-to-cart-stamp').innerHTML = stampProd;
    }

The problem is that when i reload the page and this code is read immediately and i would like that php code was shown and read by only when i checked on radio button. Because when i reload the same page and go to options of my browser -> code html i read all code of script js and in this case i would that this script is read only i checked radio button.

This is possibile with called asynchronous or an if with PHP?

Thanks for any help.

2
  • you want to not show the script in source code? Feb 25, 2016 at 10:29
  • exatc man and show the script in source code only when i check on radio button...how i do?
    – Gabriel91
    Feb 25, 2016 at 10:31

1 Answer 1

0

i got this solution for does trick for firebug for not source. because if it remove from source you will get js error.

  <div id="script">
<script>
var stampProd = "<?php $stampProd = '10001'; ?>";

function valiAnswPos(){

                if (document.getElementById("positive").checked = true)
    {
    document.getElementById('add-to-cart-stamp').innerHTML = stampProd;
    }
</script>
</div>
<script type="text/javascript">
  document.getElementById('script').innerHTML="";

</script>
1
  • I tried man but unfortunately with the same result...now i try with recal the file js in my file with called asynchronous...otherwise other possibilities? Thanks.
    – Gabriel91
    Feb 25, 2016 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.