• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling javascript within php

 
bala kan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

good morning to you all and Thanks for your quick responses.. I have to call javascript function within PHP.. my requirement is div "err1" should be displayed in the below mentoined else block.. but, it did not display..


My PHP codings are



my javascript codings are



please rectify my mistakes.. Thanks in advance..


Regards,
Bala
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"javascript" should be one word not two (in your PHP code, the <script> block)
 
bala kan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi Nick, after removing the space between "java script"in <script> block.. it doesn't work..

rectify me

Thanks in advance



Regards,
bala
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check whether there are any error JavaScript errors in the browser's error console.
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would also check the HTML source withon the browser to make sure that the script appears where you think it should.
 
bala kan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nick,

Good morning to you, HTML codings are


<form action="#" method="post">
<img src="images/text1.gif" alt="" width="56" height="11" />
<input type="text" class="input" name="username" />
<img src="images/text2.gif" alt="" width="56" height="11" />
<input type="text" class="input" name="password"/><br />
<input type="submit" class="button" value="Enter" /><br>
<div id="err1" style="display:none;"></div>
this div will be hidden by default.. and it should be showed when the given login id and password do not match

<!--<input type="button" class="button" value="Enter" /><br />-->
<input type="checkbox" class="checkbox" /><img src="images/text3.gif" alt="" width="70" height="13" /><br />
</form>



But, it gives me the problem.. Help me..

Thanks in Advance..


Regards,

Bala


 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Check whether there are any error JavaScript errors in the browser's error console.
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the entire HTML source? I don't see any <script> tags. Scripts that don't exist can't be run.
 
bala kan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nick,


Good Morning to you,


My PHP Codings are








My Html codings are:

<form action="#" method="post">
<img src="images/text1.gif" alt="" width="56" height="11" />
<input type="text" class="input" name="username" />
<img src="images/text2.gif" alt="" width="56" height="11" />
<input type="text" class="input" name="password"/><br />
<input type="submit" class="button" value="Enter" /><br>
<div id="err1" style="display:none;"></div>

this div will be hidden by default.. and it should be showed when the given login id and password do not match


<!--<input type="button" class="button" value="Enter" /><br />-->
<input type="checkbox" class="checkbox" /><img src="images/text3.gif" alt="" width="70" height="13" /><br />
</form>
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Nick noted

should be
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic