Page 1 of 1

javascript function not working on live server

Posted: Fri Sep 12, 2014 2:26 am
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

Re: javascript function not working on live server

Posted: Fri Sep 12, 2014 3:19 am
by requinix
And where are we supposed to find this textfield thing you speak of?

Re: javascript function not working on live server

Posted: Fri Sep 12, 2014 3:43 am
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>

Re: javascript function not working on live server

Posted: Fri Sep 12, 2014 7:17 am
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)