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 7410205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:12:02+00:00 2026-05-29T06:12:02+00:00

This onclick function: VVi.$row[‘id’]..onclick = function() { alert(‘1’); var ResultI = ‘.$row[‘id’].’; location.href=’visuals.php?ResultI=’ +

  • 0

This onclick function:

VVi".$row['id'].".onclick = function() {
   alert('1');
   var ResultI = '".$row['id']."';
   location.href='visuals.php?ResultI=' + ResultI + '&pg=' + pgi + '&vid=false';
};

Cannot be called on firefox… I tried it on chrome and opera, and everything worked fine… So how can i call the function that everything would work fine on all browsers. I need similar method, because i dont want related codes to get effect… Thanks

Edit:

Firefox result:

<a class='menuLink' id='VVi19'>
<div id='IIi19' style='width: 230px;
height: 136px;
background: url(res/images/images.jpg);
background-size: contain;
background-repeat: no-repeat;
background-position:center;'></div>
</a>
</td>
<script type='text/javascript'>
VVi19.onclick = function() {
    alert('1');
var ResultI = '19';
location.href='visuals.php?ResultI=' + ResultI + '&pg=' + pgi + '&vid=false';
     };
</script>
  • 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-29T06:12:03+00:00Added an answer on May 29, 2026 at 6:12 am

    A function declared as a closure as you have done there is an assignment statement and as such must be terminated with a semi-colon ;.

    Some ECMAScript engines are more forgiving than others about this – try adding the semi-colon, like so:

         // ...
         location.href='visuals.php?ResultI=' + ResultI + '&pg=' + pgi + '&vid=false';
       };
    //  ^ Add this teminator
    

    Edit after inspecting the whole code it would seem that the problem is that your tag order is all messed up, and that is why it is not working. Amongst other things, a <script> element is not valid as a direct child of a <table>, and a <td> should be enclosed in a <tr>. You also assign a static id= in a loop, which result in duplicated element IDs, and you seem to be referencing HTML elements using an object named with their ID, without assigning the element to the object.

    Try changing:

    VVi".$row['id'].".onclick = function() {
    

    To:

    document.getElementById('VVi".$row['id']."').onclick = function() {
    

    …although even if this does fix your immediate problem, you will likely find other stuff that doesn’t work. You need to pass all you generated pages through the W3C markup validation service and you should also see what JSLint has to say about your Javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a difference between this: var onClick = function() { var image =
Code is not running on .click when I have this: $(.cancel).click(function() { alert(got here);
How can I achieve this behaviors onclick with jquery : default state: <a href=something.html>Anchor</a>
I get a longString from object's onclick value var longString = String(this.onclick); output like
What is the difference betwen setting the onclick function in this way: obj.onclick=new Function('functionname')
I want to send more arguments through this onclick function, but I'm having trouble
I'm trying to add an onclick event to a table row through Javascript. function
When I include an 'onClick' attribute in setInnerXTHML() like this: var innerHtml = '<span>Build
I've got this onclick call: onClick=mySubmit(); which calls this function: function mySubmit(){ document.getElementById(myForm).submit(); }
I have been able to successfully get another elements onclick function by doing this:

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.