Jump to content

Recommended Posts

im getting this error

 

Uncaught ReferenceError: changeAvi is not defined
    at HTMLSelectElement.onchange

 

I have the script working on another website which works fine ive simply tried to add it to my new website and getting this error

 


I have the script at the top of the page
      

 <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <script src="https://pkmnhelios.com/membersarea_files/button.e7f9415a2e000feaab02c86dd5802747.js.download"></script>
<script src="exponential.js"></script>
  
     <script type="text/javascript">
 function changeAvi(){
     var image = document.getElementById('avatarchange');
     var dropd = document.getElementById('Avatar');
   image.src = dropd.value;
     };
 </script> 

<br>
 <input type="submit" name="update" id="button"/> </form>

<p>
  <script type="text/javascript">
 function changeAvi(){
     var image = document.getElementById('avatarchange');
     var dropd = document.getElementById('Avatar');
   image.src = dropd.value;
     };
 </script> 

 

 

Then i run some php

 

 

oose your avatar <br><?php     echo '<img id=avatarchange src=images/trainers/000.png />'; ?>
                   <?php
     echo '<select name="avatar" id="Avatar" onChange="changeAvi()"">';
      $sql6=mysqli_query($link,"SELECT * FROM avatars");
     while ($row6=mysqli_fetch_array($sql6)){
     echo "<option value='".$row6['Image']."'>".$row6['Name']."</option>";
         ?>
    
    <?php
         
         
      }
     echo '</select>';   

 

And yes im gonna update it to pdo  again this script works on another page inside my site but not a blank page 

Edited by geatzo
Link to comment
https://forums.phpfreaks.com/topic/320172-uncaught-referenceerror/
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.