התחבר | הרשמה | שאלות נפוצות
Anonymous

Buttons don't work

+ פרסם תגובה

6 הודעות עמוד 1 מתוך 1


Buttons don't work

על ידי MGLP » ב' פברואר 20, 2017 11:05 pm

My website home page has a CONTACTS button. This used to work but now it doesn't.
Upon clicking the button, my PHP function should get executed but it is not.
Neither of the following 2 tags work.

<input type=\"button\" value=\"Contacts\" onclick=\"mycontacts()\">

<button type=\"button\" onclick=\"mycontacts()\">Contacts</button>

My function is as follows. Clicking the button does not execute this function. I put an alert (\"OK\") as the first thing and it doesn't get execute.

function mycontacts()
{location.href=\"HA_Contacts.php\";return false;
window.open(location.href); return false;}
סמל אישי של המשתמש

MGLP

  • הודעות: 5
  • הצטרף: ב' פברואר 20, 2017 10:51 pm

Re: Buttons don't work

על ידי Farhin Qureshi » ה' פברואר 23, 2017 10:39 am

Hi,
I have editted your code with some addition of tags so plzz refer the below code:
קוד: בחר הכל
<script>
    function mycontacts(){
alert();
}
</script>
<!-- <div id="view4"><iframe src="https://www.google.com/maps/d/embed?mid=1e2GLYE2_l0uFz283uVxb2qVaMys" width="640" height="480"></iframe></div> -->
<!-- </div> -->
<input type="button" value="Contacts" onclick="mycontacts()">

<button type="button" onclick="mycontacts()" id="b1">Contacts</button>

סמל אישי של המשתמש

Farhin Qureshi

  • הודעות: 45
  • הצטרף: ג' ינואר 03, 2017 11:33 am
--
Farhin Qureshi
.NET Developer
http://www.ifourtechnolab.com

Re: Buttons don't work

על ידי MGLP » ו' מרץ 03, 2017 1:48 pm

Thank you Farhin but I tried it and it doesn't work. I get Parse error: "syntax error, unexpected 'view4' (T_STRING) in C:\xampp\htdocs\HomeAccounting\Index.php on line 114".
Also, I don't understand your code. It is calling for google maps but that is not what I want. When my user clicks the button, control is supposed to go to my "Function mycontacts()" which is supposed to load my file "HA_Contacts.php" But it's not doing it. It's not doing anything.
סמל אישי של המשתמש

MGLP

  • הודעות: 5
  • הצטרף: ב' פברואר 20, 2017 10:51 pm

Re: Buttons don't work

על ידי MGLP » ו' מרץ 03, 2017 1:48 pm

Thank you Farhin but I tried it and it doesn't work. I get Parse error: "syntax error, unexpected 'view4' (T_STRING) in C:\xampp\htdocs\HomeAccounting\Index.php on line 114".
Also, I don't understand your code. It is calling for google maps but that is not what I want. When my user clicks the button, control is supposed to go to my "Function mycontacts()" which is supposed to load my file "HA_Contacts.php" But it's not doing it. It's not doing anything.
סמל אישי של המשתמש

MGLP

  • הודעות: 5
  • הצטרף: ב' פברואר 20, 2017 10:51 pm

Re: Buttons don't work

על ידי MGLP » ו' מרץ 03, 2017 2:14 pm

Sorry. I should have mentioned that if I use "<button type=\"button\" onclick=\"mycontacts()\">Contacts</button>" it works, i.e., my contacts file get loaded. But this doesn't give me the button I want to appear on my page; it only gives me the word "CONTACTS".
סמל אישי של המשתמש

MGLP

  • הודעות: 5
  • הצטרף: ב' פברואר 20, 2017 10:51 pm

Re: Buttons don't work

על ידי BertieKerter1 » ב' מאי 22, 2017 2:43 am

You question helped me.
סמל אישי של המשתמש

BertieKerter1

  • הודעות: 1
  • הצטרף: ב' מאי 22, 2017 2:36 am


+ פרסם תגובה

עמוד 1 מתוך 1