Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: php vs. javascript  (Read 9208 times)

0 Members and 1 Guest are viewing this topic.

r3ynz_t4nz

    Topic Starter


    Beginner
  • A programmer is a king
    php vs. javascript
    « on: December 10, 2008, 09:48:10 PM »
    can someone help me., and translate or generate this code javascript code in php..,

    <html>
    <head>
    <title> </title>
    </head>
    <body>

    <form name="my_form" method="post">

    <textarea onKeyPress=check_length(my_form);
              onKeyDown=check_length(my_form);
             name="my_text"
             rows=4 cols=30>
             
    </textarea>


    <input size=1 value=50 name=text_num> Characters Left

    </form>

    <script language=JavaScript>

       function check_length(my_form){

       maxLen = 50;

          if ( my_form.my_text.value.length >= maxLen ) {

               var msg = "You have reached your maximum limit of characters allowed";
             
               alert(msg);

               my_form.my_text.value = my_form.my_text.value.substring(0, maxLen);
     
          }

          else {

                my_form.text_num.value = maxLen - my_form.my_text.value.length;
          
          }

       }

    </script>

    </body>
    </html>

    r3ynz_t4nz

      Topic Starter


      Beginner
    • A programmer is a king
      Re: php vs. javascript
      « Reply #1 on: December 10, 2008, 09:49:55 PM »
      sorry.., i mean this javascript code in php.,.,

      kpac

      • Web moderator
      • Moderator


      • Hacker

      • kpac®
      • Thanked: 184
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 7
      Re: php vs. javascript
      « Reply #2 on: December 11, 2008, 10:06:44 AM »
      I'm not sure what you mean by translate, but if you save the file you have as *.php, it will still work.

      r3ynz_t4nz

        Topic Starter


        Beginner
      • A programmer is a king
        Re: php vs. javascript
        « Reply #3 on: December 12, 2008, 05:00:05 AM »
        what i mean., is to convert this code into php., or a code similar to php

        kpac

        • Web moderator
        • Moderator


        • Hacker

        • kpac®
        • Thanked: 184
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 7
        Re: php vs. javascript
        « Reply #4 on: December 12, 2008, 09:13:41 AM »
        Just use this:

        Code: [Select]
        <?php

        echo '
        <html>
        <head>
        <title> </title>
        </head>
        <body>

        <form name="my_form" method="post">

        <textarea onKeyPress=check_length(my_form);
                  onKeyDown=check_length(my_form);
                 name="my_text"
                 rows=4 cols=30>
                 
        </textarea>
        <br>
        <input size=1 value=50 name=text_num> Characters Left

        </form>

        <script language=JavaScript>

           function check_length(my_form){

           maxLen = 50;

              if ( my_form.my_text.value.length >= maxLen ) {

                   var msg = "You have reached your maximum limit of characters allowed";
                 
                   alert(msg);

                   my_form.my_text.value = my_form.my_text.value.substring(0, maxLen);
         
              }

              else {

                    my_form.text_num.value = maxLen - my_form.my_text.value.length;
              
              }

           }

        </script>

        </body>
        </html>
        '
        ;

        ?>

        r3ynz_t4nz

          Topic Starter


          Beginner
        • A programmer is a king
          Re: php vs. javascript
          « Reply #5 on: December 15, 2008, 08:45:31 PM »
          that's not what i mean., but anyway thanks

          kpac

          • Web moderator
          • Moderator


          • Hacker

          • kpac®
          • Thanked: 184
            • Yes
            • Yes
            • Yes
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 7
          Re: php vs. javascript
          « Reply #6 on: December 16, 2008, 09:23:41 AM »
          Well then, what do you mean?

          fffreak



            Adviser

          • That's right I am a final fantasy freak.
          • Thanked: 3
            • Yes
            • JSPCRepair
          • Certifications: List
          • Experience: Guru
          • OS: Windows 7
          Re: php vs. javascript
          « Reply #7 on: December 29, 2008, 02:37:10 PM »
          You cannot translate Javascript into PHP, Javascript is a user side scripting language, and can only be embedded in php which is a server side scripting language. Although if what you meant was to have a php function call a Javascript method, that is highly possible ;).
          Computers are the future, not us. Learn everything you can about them while you still can, soon they will be learning about us... Every bit of advice that I give you is best guess, it is your choice whether or not you listen to it.

          r3ynz_t4nz

            Topic Starter


            Beginner
          • A programmer is a king
            Re: php vs. javascript
            « Reply #8 on: January 02, 2009, 11:49:16 PM »
            thanks.,

            demo71



              Rookie

              Re: php vs. javascript
              « Reply #9 on: January 14, 2009, 01:49:31 AM »
              Someone help me, what's wrong this line:

              <INPUT TYPE="BUTTON" VALUE="   WinZip   " ONCLICK="window.location.href='file:///C:/Program Files/WinZip/Winzip32.exe'">


              Thank you

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: php vs. javascript
              « Reply #10 on: January 14, 2009, 02:18:14 AM »
              Someone help me, what's wrong this line:

              <INPUT TYPE="BUTTON" VALUE="   WinZip   " ONCLICK="window.location.href='file:///C:/Program Files/WinZip/Winzip32.exe'">


              Thank you

              nothing appears syntactically wrong, althugh every single person who ever clicks the button will need to have a "C:/Program Files/WinZip/Winzip32.exe" file.

              This also has absolutely nothing to do with the topic.
              I was trying to dereference Null Pointers before it was cool.

              demo71



                Rookie

                Re: php vs. javascript
                « Reply #11 on: January 14, 2009, 02:57:40 AM »
                This good
                ....ONCLICK="window.location.href='http://www.gogle.com'"

                This wrong
                ....ONCLICK="C:/Program Files/WinZip/Winzip32.exe"

                Click button, but nothing?

                Pls

                BC_Programmer


                  Mastermind
                • Typing is no substitute for thinking.
                • Thanked: 1140
                  • Yes
                  • Yes
                  • BC-Programming.com
                • Certifications: List
                • Computer: Specs
                • Experience: Beginner
                • OS: Windows 11
                Re: php vs. javascript
                « Reply #12 on: January 14, 2009, 03:08:23 AM »
                what is this for? a web page on the internet?
                I was trying to dereference Null Pointers before it was cool.

                demo71



                  Rookie

                  Re: php vs. javascript
                  « Reply #13 on: January 14, 2009, 03:39:54 AM »
                  Sorry,

                  this programme lines have for web page.
                  On page found link buttons

                  One button click -> internet

                  One button click -> call my computer program

                  etc

                  BC_Programmer


                    Mastermind
                  • Typing is no substitute for thinking.
                  • Thanked: 1140
                    • Yes
                    • Yes
                    • BC-Programming.com
                  • Certifications: List
                  • Computer: Specs
                  • Experience: Beginner
                  • OS: Windows 11
                  Re: php vs. javascript
                  « Reply #14 on: January 14, 2009, 03:41:07 AM »
                  so, every single person who uses the web page will have winzip installed?
                  I was trying to dereference Null Pointers before it was cool.

                  demo71



                    Rookie

                    Re: php vs. javascript
                    « Reply #15 on: January 14, 2009, 03:45:51 AM »
                    All person who used this web page already installed winzip program,


                    demo71



                      Rookie

                      Re: php vs. javascript
                      « Reply #16 on: January 14, 2009, 03:48:23 AM »
                      Sorry i have go to doctor, tomorrow back again

                      Thank you answers

                      demo71 quit

                      kpac

                      • Web moderator
                      • Moderator


                      • Hacker

                      • kpac®
                      • Thanked: 184
                        • Yes
                        • Yes
                        • Yes
                      • Certifications: List
                      • Computer: Specs
                      • Experience: Expert
                      • OS: Windows 7
                      Re: php vs. javascript
                      « Reply #17 on: January 14, 2009, 09:35:28 AM »
                      Please stop hijacking other topics.

                      Start a new one.