Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. show alert in javascript and not continue

show alert in javascript and not continue

Scheduled Pinned Locked Moved JavaScript
javascripttoolsquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ptvce
    wrote on last edited by
    #1

    hi i use this code:

    <script type='text/javascript'>
    function ValidateFileSize(strFUS) {
    var filename = document.getElementById('<%=fuSignature.ClientID%>');

            var myFSO = new ActiveXObject("Scripting.FileSystemObject");
    
            var filepath = filename.value;
    
            var thefile = myFSO.getFile(filepath);
    
            var size = thefile.size;
    
            if (size / 1024 < 110)
                return true;
            alert('the size of file is big');
            return false;
    
        }
    

    </script>

    this code is work and show me the alert but when i click on ok button in allert box the file uploadbut i want it not be upload. what should i do? plz

    J M 2 Replies Last reply
    0
    • P ptvce

      hi i use this code:

      <script type='text/javascript'>
      function ValidateFileSize(strFUS) {
      var filename = document.getElementById('<%=fuSignature.ClientID%>');

              var myFSO = new ActiveXObject("Scripting.FileSystemObject");
      
              var filepath = filename.value;
      
              var thefile = myFSO.getFile(filepath);
      
              var size = thefile.size;
      
              if (size / 1024 < 110)
                  return true;
              alert('the size of file is big');
              return false;
      
          }
      

      </script>

      this code is work and show me the alert but when i click on ok button in allert box the file uploadbut i want it not be upload. what should i do? plz

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      you need to call this onSubmit of the form:

      ...

      and the return in there is essential

      P 1 Reply Last reply
      0
      • J J4amieC

        you need to call this onSubmit of the form:

        ...

        and the return in there is essential

        P Offline
        P Offline
        ptvce
        wrote on last edited by
        #3

        oooh , i forgot write return in önsubmit="return ValidateFileSize()" thanks so much. :)

        1 Reply Last reply
        0
        • P ptvce

          hi i use this code:

          <script type='text/javascript'>
          function ValidateFileSize(strFUS) {
          var filename = document.getElementById('<%=fuSignature.ClientID%>');

                  var myFSO = new ActiveXObject("Scripting.FileSystemObject");
          
                  var filepath = filename.value;
          
                  var thefile = myFSO.getFile(filepath);
          
                  var size = thefile.size;
          
                  if (size / 1024 < 110)
                      return true;
                  alert('the size of file is big');
                  return false;
          
              }
          

          </script>

          this code is work and show me the alert but when i click on ok button in allert box the file uploadbut i want it not be upload. what should i do? plz

          M Offline
          M Offline
          MKAdeel
          wrote on last edited by
          #4

          hi ptvc, you code is ok, you only need to return the function value where you call the function. for example you call it on a button click you would write

          P 1 Reply Last reply
          0
          • M MKAdeel

            hi ptvc, you code is ok, you only need to return the function value where you call the function. for example you call it on a button click you would write

            P Offline
            P Offline
            ptvce
            wrote on last edited by
            #5

            yes, i forgot write return, Thanks

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups