Click here to Skip to main content
13,000,619 members (66,849 online)
Rate this:
Please Sign up or sign in to vote.
See more:
<!DOCTYPE html>
<html xmlns="">
    <meta  charset="utf-8"/>
    <title>Html Page</title>
    <script src="Content/scripts/jquery-1.8.0.min.js"></script>
    <script src="Content/scripts/jquery-ui-1.8.24.custom.min.js"></script>
    <script type="text/javascript">
'I need help. My webpage won't respond to my Javascript code as shown below and was trying to change the table attributes using Javascript but the changes do not show when I load the page in my browser:
        function changeStyle(myTable) {
            var change = document.getElementById("myTable");
            if (change == true) {
       = "4px";
       = "blue";
    <style type="text/css">
        .auto-style1 {
            width: 294px;
        <table id="myTable" style="width: 300px; height: 500px; border: solid 1px black; background-color: Red;">
                <td class="auto-style1">Hello </td>
Posted 4-Oct-12 11:15am
Updated 4-Oct-12 11:18am
What exactly did you try to achieve, and what do you see, in response to what events? Did you try to run anything under debugger?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In this code, I cannot see any event handler at all. Besides, you include jQuery library, but never use it. If this is all you have, absolutely no wonder that nothing happens.

If you want a typical jQuery approach, which I would strongly recommend, you can handle only document.ready and add other handlers in the handler of this event, so you never need adding any handlers in HTML. In this case, this script should come in <body>, not in <head> element:[^].

Also, do you know how to use the debugger?

udoyen 4-Oct-12 18:42pm
Hi SA,
Are u saying I should have put an event handler in the table?
No! Please see how jQuery works, the link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100