Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getElementById is wierd

    i've got this:
    Code:
    var calItem = document.getElementById('dynamicTable');
            calItem.innerHTML="";
    in an external javascript, and it was working fine. when i change dynamicTable from a tbody to a dl, i got "dynamicTable has no properties"
    same thing if i tried to appendChild()

    the wierdest part is that if i were to change my element id from dynamicTable to calItem, everything would work fine, as long as i had a html 4 doctype and if my doctype is xhtml, i get "calItem is not defined".

    what gives?

  • #2
    New Coder
    Join Date
    Apr 2006
    Location
    At a place
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don't use a doctypes. They're retarded.
    Uhh... Yeah Sure.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by v777tony
    Don't use a doctypes. They're retarded.
    You have a lot to learn. Ever wonder why your pages look good in IE but like crap in Firefox? A doctype helps. Your pages have been invalid all this time. Let me guess you are probably one of those coders that codes for IE only because you don't know any better.

    @kyleschrama Please post the rest of your code or post a link.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <script type="text/javascript">
    function getElement(){
        var headItem = document.getElementById('header');
        alert(headItem.innerHTML);
    }
    
    window.onload=getElement;
    </script>
    </head>
    <body>
    
    <h1 id="header">My header</h1>
    
    
    
    </body>
    </html>
    here's the same problem, reproduced. the code i was having the problem with is really long, i wont post it.

    if i take the contents of the function, and put it in a script element in the body, it works

    EDIT: nevermind, that's working now. i'll keep playing with the code, but if anybody has any ideas of why it might not work, post em.

    thanks,
    kyle
    Last edited by kyleschrama; 06-04-2006 at 12:18 AM.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Only reason why it might not work is the element isn't created yet so you need to call the function onload because by then all elements will have been created.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    window.onload=getElement;
    i thought of that. it's just so confusing. thanks for the idea thought

  • #7
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    If you intend to code for strict XHTML, you may use the standard W3C DOM

    headItem.firstChild.data
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #8
    New Coder
    Join Date
    Apr 2006
    Location
    At a place
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Doctype

    Quote Originally Posted by _Aerospace_Eng_
    You have a lot to learn. Ever wonder why your pages look good in IE but like crap in Firefox? A doctype helps. Your pages have been invalid all this time. Let me guess you are probably one of those coders that codes for IE only because you don't know any better.

    @kyleschrama Please post the rest of your code or post a link.
    I don't know if there is a DOCTYPE for my page. I've tried all of them. But, if you can find one for this code below. I'll be happy
    Code:
    <html>
    <head>
    <title>The Andrew &amp; Andrew Show 104.7</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="Content-Script-Type" content="text/javascript"/>
    <meta http-equiv="Content-Style-Type" content="text/css"/>
    <meta name="Author" content="Anthony L. Vanover II"/>
    <meta name="Keywords" content="christian metal,christian heavy metal,christian death metal, christian metal radio,christian black metal,christian heavy metal music,christian metal music,104.7 fm,104.7 fm radio,104.7 fm radio station,104.7 fm the fish,104.7 1hit fm music station,104.7 fm music station,104.7 #1 hit fm music station,104.7 number 1 music station,broadcast,radio broadcast,live broadcast,live radio broadcast,fm broadcast,free radio broadcast,broadcast media,broadcast music,christian rock,christian rock music, christian rock radio,christian hard rock,christian punk rock, christian rock radio station,christian rock station,christian hit rock,christian alternative rock,hard rock christian music, christian rock hit,christian music rock,rock and roll christian music,top christian rock,rock,emo rock,emo style rock,hard rock,metal,hard metal,shazam,andrew,god,music,radio,radio station,radio music,radio station music"/>
    <meta name="Description" content="The Andrew &amp; Andrew Show...richous mind-melting music that ROCKS!!!... The #1 Christian Metal station...Listen for the word SHAZAM!!! From Yuba City to Marrysville...9-10"/>
    <meta http-equiv="Site-Enter" content="progid:DXImageTransform.Microsoft.gradientWipe(duration=2)"/>
    <meta http-equiv="Page-Exit" content="progid:DXImageTransform.Microsoft.pixelate(duration=2)"/>
    <script src="javascript\time.js"></script>
    <script src="javascript\search.js"></script>
    <script src="javascript\sound.js"></script>
    <script src="javascript\load.js"></script>
    </head>
    <body onload="startTime();" bgcolor="#000000" text="#FFFFFF" link="#008000" vlink="#FF0000" style="cursor:url(cursors\cursorred.cur); SCROLLBAR-FACE-COLOR:#0000FF;SCROLLBAR-ARROW-COLOR:#FF0000;SCROLLBAR-3DLIGHT-COLOR:#FFFFFF;SCROLLBAR-DARKSHADOW-COLOR:#000000;SCROLLBAR-HIGHLIGHT-COLOR:#FFFFFF;SCROLLBAR-SHADOW-COLOR:#000000;SCROLLBAR-TRACK-COLOR:#008080;">
    <div id="time" style="position:absolute; left:30px; top:15px; width:673px; height:0px; z-index:0" align="right" valign="top"></div>
    <div style="position:absolute; left:30px; top:9px; width:666px; height:34px; z-index:0" align="center" valign="top">
    <font style="font-size:16pt" color="#FFFFFF" face="BixAntiqueScriptHmkBold">The Andrew &amp; Andrew Show</font>
    </div>
    <hr size="3" width="679" style="position:absolute;left:24px;top:51px;width:679px;height:3px;z-index:1"/>
    <div style="position:absolute; left:24px; top:41px; width:679px; height:27px; z-index:3" align="center" valign="top">
    <embed src="sound\menu1.wav" name="navsound0" autostart="false" hidden="true" volume="100" width="0" height="0"/>
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="left" valign="top" width="131" height="27"><a href="au.htm" onmouseover="playSound('navsound0')"><img style="cursor:url(cursors\cursorgreen.cur)" src="pic\1.gif" class="rollover pic\1_over.gif" alt="Learn our ways" align="top" border="0" width="131" height="27"/></a></td>
    <td width="6"></td><td align="left" valign="top" width="131" height="27"><a href="cu.htm" onmouseover="playSound('navsound0')"><img style="cursor:url(cursors\cursorgreen.cur)" src="pic\2.gif" class="rollover pic\2_over.gif" alt="How to contact A&amp;A" align="top" border="0" width="131" height="27"/></a></td>
    <td width="6"></td><td align="left" valign="top" width="131" height="27"><a href="ak.htm" onmouseover="playSound('navsound0')"><img style="cursor:url(cursors\cursorgreen.cur)" src="pic\3.gif" class="rollover pic\3_over.gif" alt="Learn about one of the hosts" align="top" border="0" width="131" height="27"/></a></td>
    <td width="6"></td><td align="left" valign="top" width="131" height="27"><a href="aw.htm" onmouseover="playSound('navsound0')"><img style="cursor:url(cursors\cursorgreen.cur)" src="pic\4.gif" class="rollover pic\4_over.gif" alt="Learn about one of the hosts" align="top" border="0" width="131" height="27"/></a></td>
    <td width="6"></td><td align="left" valign="top" width="131" height="27"><a href="ml.htm" onmouseover="playSound('navsound0')"><img style="cursor:url(cursors\cursorgreen.cur)" src="pic\5.gif" class="rollover pic\5_over.gif" alt="View time listings for broadcasted music" align="top" border="0" width="131" height="27"/></a></td>
    </tr>
    </table>
    </div>
    <div style="position:absolute; left:24px; top:95px; width:680px; height:256px; z-index:4"  align="left" valign="top">
    <table width="100%" height="100%" border="2" cellpadding="0" cellspacing="0">
    <tr>
    <td align="left" valign="top" width="676" height="252"><font style="font-size:14pt" color="#40E0D0" face="Times New Roman">Welcome,<br/>
    Every Friday we (Andrew &amp; Andrew) broadcast richous mind-melting music that ROCKS!!! As Christians, we believe god should always be apart of our lives. We also love Rockin' music. So, we decided to broadcast good, wholesome, Christian METAL. Now a lot of the time you can't understand what the heck they're sayin'. So, we interpret it for you at the beginning of each song.</font>
    <font style="font-size:8pt" color="#40E0D0" face="Times New Roman">*This Message is brought to you by The Andrew &amp; Andrew Show*<br/></font>
    <font style="font-size:14pt" color="#40E0D0" face="Times New Roman">SHAZAM!!!<br/><br/></font>
    <font style="font-size:12pt" color="#40E0D0" face="Times New Roman">The Andrew &amp; Andrew Show,<br/>
    From Yuba City to Marrysville @ 9-10.<br/><br/>
    Listen to the word SHAZAM!!! on 104.7.</font></td>
    </tr>
    </table>
    </div>
    <div style="position:absolute; left:25px; top:361px; width:678px; height:26px; z-index:2" align="left" valign="top">
    <p/><font color="#FFFFFF" size="3" face="Courier New CE"><strong><marquee style="cursor:url(cursors\cursorred.cur)" bgcolor="#000000" height="26" direction="right" scrolldelay="1" scrollamount="4" behavior="scroll" align="top" loop="0">Site Made By <a href="av.htm" style="cursor:url(cursors\linkhand.cur)">Anthony L. Vanover II</a></marquee></strong></font>
    </div>
    <div style="position:absolute; left:25px; top:394px; width:678px; height:27px; z-index:5"  align="left" valign="top">
    <p/><font color="#FFFFFF" size="3" face="Courier New CE"><strong><marquee style="cursor:url(cursors\cursorred.cur)" bgcolor="#000000" height="27" direction="left" scrolldelay="1" scrollamount="4" behavior="scroll" align="top" loop="0">The #1 Christian Metal Show On 104.7</marquee></strong></font>
    </div>
    <div style="position:absolute; left:25px; top:430px; width:300px; height:0px; z-index:0" align="left" valign="top">
    <font style="font-size:10pt" color="#FFFFFF" face="Times New Roman">
    <p/>The Andrew &amp; Andrew Show offer you a search box from Google&copy; and Yahoo&reg;.
    <p/>And guess what... you can use them both at the same time!
    </font>
    </div>
    <div style="position:absolute; left:25px; top:430px; width:680px; height:0px; z-index:0" align="right" valign="top">
    <form style="cursor:url(cursors\cursoryellow.cur)" action="javascript:DoSearch();" name="ToolBox" style="line-height: 2em;">
    Enter search term(s): <input style="cursor:url(cursors\cursoryellow.cur)" type="text" name="SearchBox" size="22"/>
    <br/>
    <input type="radio" name="SearchOption" value="Google" onclick="document.ToolBox.SearchBox.focus()"/>Google
    <input type="radio" name="SearchOption" value="Yahoo" onclick="document.ToolBox.SearchBox.focus()"/>Yahoo
    <input type="radio" name="SearchOption" value="Both" onclick="document.ToolBox.SearchBox.focus()"/>Both
    <br/>
    <input type="submit" value=" Search " onmouseover="playSound('navsound0')" style="cursor:url(cursors\cursoryellow.cur)"/>
    </form>
    </div>
    <div style="position:absolute; left:25px; top:520px; width:680px; height:0px; z-index:0" align="right" valign="top">
    <font size="2"><b>Google&copy; and Yahoo&reg; are not &trade; 's of KCYC and/or The Andrew &amp; Andrew Show</b></font>
    </div>
    <div style="position:absolute; left:25px; top:520px; width:300px; height:10px; z-index:0" align="left" valign="bottom">
    <a style="cursor:url(cursors\linkhand.cur)" href="lyrics.htm"><font style="font-size:10pt" face="Times New Roman">Get lyrics to broadcasted music</font></a>
    </div>
    <embed src="sound\Demon Hunter - Undying.mp3" autostart="true" loop="false" hidden="true" volume="100" width="0" height="0"/>
    <script src="javascript\rollover.js"></script>
    </body>
    </html>
    Uhh... Yeah Sure.

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by v777tony
    I don't know if there is a DOCTYPE for my page. I've tried all of them. But, if you can find one for this code below. I'll be happy
    Try this one
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    By the way some of your file paths are incorrect. In HTML file paths use / not \ so for example this
    Code:
    <script src="javascript\time.js"></script>
    should be this
    Code:
    <script src="javascript/time.js"></script>
    You do this in a lot more places on your page.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    New Coder
    Join Date
    Apr 2006
    Location
    At a place
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation html 4 transitional DOCTYPE

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    This DOCTYPE didn't work, it looked the way it did last time in firefox.
    (images are out of line & embed tags don't seem to work.)
    Uhh... Yeah Sure.

  • #11
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The images might be out of line, etc, etc but thats only because your code is bad. Run it through the validator http://validator.w3.org to see your errors. Did you even fix your image paths, they are incorrect. HTML uses / not \
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #12
    New Coder
    Join Date
    Apr 2006
    Location
    At a place
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Quote Originally Posted by _Aerospace_Eng_
    The images might be out of line, etc, etc but thats only because your code is bad. Run it through the validator http://validator.w3.org to see your errors. Did you even fix your image paths, they are incorrect. HTML uses / not \
    What about self-closing tags?
    Uhh... Yeah Sure.

  • #13
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Self closing tags are still / for example <br> in XHTML would be
    <br />. Now that I see you are using XHTML try this doctype though I think you should try to get a better understanding of HTML first since you still seem to be using many old tags. Tables aren't for page layout either. They are to display data. Try this doctype.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #14
    New Coder
    Join Date
    Apr 2006
    Location
    At a place
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I used the xhtml doctype and ran it through the validation. It says that certain attributes don't exist or aren't specified. Also, embed tag dosn't exist.
    and this other thingy:

    Line 57, character 4: <p/>The Andrew &amp; Andrew Show offer you a search box from ...
    Error: element p not allowed here; possible cause is an inline element containing a block-level element
    Uhh... Yeah Sure.

  • #15
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    A paragraph can't go inside of a font tag. Font is an inline element. A paragraph is a block level element. Embed has never been part of the standard which is why it says its invalid. Upload your page somewhere.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •