Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6883503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:23:29+00:00 2026-05-27T05:23:29+00:00

My code (Below) works in Internet Explorer, but not in Chrome, Safari or Mozilla

  • 0

My code (Below) works in Internet Explorer, but not in Chrome, Safari or Mozilla Firefox. Not sure why, but would it be possible for someone to point me in the right direction? This code has some buttons which change the form’s action attribute and direct the data to different PHP controller file to do different things such as create user, modify user etc

JavaScript code:

<script language="javascript">

function formAction(flag) {
    switch (flag){
        case "create": 
            document.forms.useraction.action = "/apps/portal_admin/create_user1.php";
            break;
        case "modify":
            document.forms.useraction.action = "/apps/portal_admin/modify_user1.php";
            break;
        case "copy":
            document.forms.useraction.action = "/apps/portal_admin/copy_user1.php#user2";
            break;
    }
    document.forms.useraction.submit();
}
function helloworld() {
    alert("Hello World");
}
</script>

PHP code:

<?php
    if ($authlib->auth_authobj($posting_userid,$_COOKIE['shost_app_id'],'002')>=2) {
        echo "<input type=\"button\" value=\"Create User\" class=\"formButton\" name=\"create\" id=\"create\" onClick=\"formAction('create')\">\n";
        echo "<input type=\"button\" value=\"Copy User\" class=\"formButton\" name=\"copy\" onClick=\"formAction('copy')\">\n";
    }
    if ($authlib->auth_authobj($posting_userid,$_COOKIE['shost_app_id'],'002')>=3) {
        echo "<input type=\"button\" value=\"Edit User\" class=\"formButton\" name=\"modify\" onClick=\"formAction('modify')\">\n";
        echo "<input type=\"button\" value=\"This button works\" class=\"formButton\" name=\"Working\" onClick=\"helloworld()\">\n";
    }
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:23:30+00:00Added an answer on May 27, 2026 at 5:23 am

    I assume that you have only one form on page. Your code has two errors.

    1
    To solve your problem, change all

      document.forms.useraction.action
    

    to

      document.useraction.action
    

    2
    Also note that formAction is a reserved handler. You can not use formaction as a function name. Change the function name to formActionz or something else:

    function formActionz(flag)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below works in FF, Safari, Chrome. But IE is giving me issues.
I'm seeing this issue in Internet Explorer 8, but not in Safari or Firefox.
The code below works. But if I comment out the line Dim objRequest As
the code below works fine but it takes an absolute age to run. How
The example code below works as as a server process. But when I add
I have to code below - works great in IE and Opera, but does
From some examples from the Internet I made the test code below. It works!
I have a code (see it below). It works perfectly in Firefox: it saves
I'm not sure if this is a glitch/quirk in the latest Firefox and Chrome,
The Code Below works as expected and when Internet is present in the text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.