Click here to Skip to main content
11,920,394 members (44,601 online)
Rate this:
Please Sign up or sign in to vote.
See more: Javascript
<!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 12:15pm
Edited 4-Oct-12 12:18pm
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
0 OriginalGriff 415
1 phil.o 170
3 F-ES Sitecore 130
4 RyanDev 120
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,805
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web01 | 2.8.151120.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2015
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