javascript function not working on live server

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
shijopj
Forum Newbie
Posts: 2
Joined: Fri Sep 12, 2014 2:18 am

javascript function not working on live server

Post by shijopj »

Hi , i am working on project in php. I have using a javascript function to hide and show a textfield.
The script is working in the localhost (xamp server). but not works on the live server..
Please help me...

http://www.build-up.in
http://www.itvoyager.com
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: javascript function not working on live server

Post by requinix »

And where are we supposed to find this textfield thing you speak of?
shijopj
Forum Newbie
Posts: 2
Joined: Fri Sep 12, 2014 2:18 am

Re: javascript function not working on live server

Post by shijopj »

here is the code

Code: Select all

<script type="text/javascript">
function changeFunction(str2)
{
    if (str2=="authors")
    {
        <?php  
        $re=mysql_query("SELECT COUNT(*) FROM `users`");$n=mysql_result($re, 0);?>
        document.getElementById("ch").innerHTML="<input type='text' class='input-short' name='nos' value='<?php echo $n;?>' style='width:100px' readonly/><span > Authors</span>";
    }
}
</script>
<form action="" method="POST">
                            <p>
                                <label>To</label>
                                <select class="input-short" name="whom" onchange="changeFunction(this.value)">
                                    <option value="0">select</option>
                                    <option value="authors">All Authors</option>
                                    <option value="readers">All Readers</option>
                                    
                                </select>
                            </p>
<p id="ch" style="font-weight:bold;">
                            </p>
</form>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: javascript function not working on live server

Post by Celauran »

shijopj wrote:but not works on the live server..
Could you be a little more specific? Also, as requinix already asked, where is this text box? (So we can see for ourselves what's going wrong)
Post Reply