The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> JavaScript On Click Runs On Page Load
FrostTaco
post May 1 2016, 07:06 PM
Post #1


Member
***

Group: Members
Posts: 47
Joined: 26-April 16
Member No.: 24,193



Hi guys, so I have some code which runs not only on click, but also on page load, which it really should not do. Here is the code
CODE
<script>
                    document.getElementById('crefer').onclick = function() {
                        var rlink = prompt("Your referal link is http://corndog.corticalcafe.com/?", "ABCYXZ");
                        if(rlink != null){
                            <?php
                                $steam64 = str_replace("http://steamcommunity.com/openid/id", "", $_SESSION['FrostyTaco']);
                                $_SESSION['steam_name'] = $content['response']['players'][0]['personaname'];
                                $name = $_SESSION['steam_name'];
                                $referbuffer = fopen("cache/refer.json", "w+");
                                $rlink = "";
                                $arr = array("$name" => "$rlink");
                                fwrite($referbuffer, json_encode($arr));
                                fclose($referbuffer);
                            ?>
                        }
                    }
                </script>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 11:06 PM