PDA

View Full Version : What's wrong with this code?



Mickword
17-08-2009, 03:26 PM
Hey guys, I coded this site for my customer and the Expandable iframe isn't working, can anyone help me. Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:#000000;
width:140px;
padding:2px;
text-align:center;
font-weight:bold;
/*/*/border:1px solid #000000;/* */
}

.submenu{
margin-bottom: 0.5em;
}
</style>

<script type="text/javascript">

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display ="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

</script>
<title>HabboTalent ~ Where Talent comes to you!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
}
.style1 {
font-size: 1px;
color: #9AE53D;
}
.style3 {font-size: 5px}
body {
background-image: url(layout/bgnews.png);
}
a:link {
color: #0099FF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #0099FF;
}
a:hover {
text-decoration: underline;
color: #6699FF;
}
a:active {
text-decoration: none;
}
a {
font-weight: bold;
}
.style4 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style></head>

<body>
<div align="center">
<table width="888" height="120" border="0" background="layout/header.png">
<tr>
<td width="580"><div align="center"></div></td>
<td width="298"><div align="center">
<table width="289" height="106" border="0" background="layout/radio_stats.png">
<tr>
<td><div align="center" class="style4">DJ Says Here - Use a iFrame </div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<table width="888" height="6" border="0" background="layout/content.png">
<tr>
<td><span class="style1">d</span></td>
</tr>
</table>
<table width="888" height="20" border="0" background="layout/djsaysbar.png">
<tr>
<td><div align="center">DJ Says Here - Use a iframe </div></td>
</tr>
</table>
<table width="888" height="100" border="0" background="layout/content.png">
<tr>
<td width="195" align="center" valign="top"><div align="center" class="style3">
<table width="191" height="20" border="0" align="center" background="layout/bars/nav_bar.png">
<tr>
<td><div align="center"></div></td>
</tr>
</table>
<img src="layout/bars/middle_bar.png" width="191" height="4" align="top">
<table width="191" border="0" background="layout/bars/content_bar.png">
<tr>
<td><div align="center">
<table width="183" border="0" align="center">
<tr>
<td width="177"><div align="center">
<div id="masterdiv">
<div align="left"><img src="layout/navigation/ht_home.png" width="177" height="20" onclick="SwitchMenu('sub1')"><span class="submenu" id="sub1">- <a href="pages/home.htm" target="content">Home</a><br>
- <a href="pages/team.htm" target="content">Meet The Team </a><br>
- <a href="pages/jobs.htm" target="content">Job Openings</a><br>
- <a href="pages/faq.htm" target="content">FAQ</a> <br>
</span> <img src="layout/navigation/ht_community.png" width="177" height="21" onclick="SwitchMenu('sub2')"><br>
<span class="submenu" id="sub2"> - <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
</span> <img src="layout/navigation/ht_radio.png" width="177" height="21" onclick="SwitchMenu('sub3')"><br>
<span class="submenu" id="sub3"> - <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
</span> <img src="layout/navigation/ht_news.png" width="177" height="21" onclick="SwitchMenu('sub4')"><br>
<span class="submenu" id="sub4"> - <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
</span> <img src="layout/navigation/ht_guides.png" width="177" height="21" onclick="SwitchMenu('sub5')"><br>
<span class="submenu" id="sub5"> - <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
</span> <img src="layout/navigation/ht_goodies.png" width="177" height="21" onclick="SwitchMenu('sub6')"><br>
<span class="submenu" id="sub6"> - <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
</span> <img src="layout/navigation/ht_forum.png" width="177" height="21" onclick="SwitchMenu('sub7')"><br>
<span class="submenu" id="sub7"> - <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
- <a href="#" target="content">Link Here</a><br>
</span> </div>
</div>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<img src="layout/bars/bottom.png" width="191" height="5" align="top"><br>
<br>
<table width="191" height="20" border="0" align="center" background="layout/bars/news_bar.png">
<tr>
<td><div align="center"></div></td>
</tr>
</table>
<img src="layout/bars/middle_bar.png" width="191" height="4" align="top">
<table width="191" border="0" background="layout/bars/content_bar.png">
<tr>
<td align="center" valign="top"><div align="center">News Here - Don't use <br>
a iFrame</div></td>
</tr>
</table>
<img src="layout/bars/bottom.png" width="191" height="5" align="top"><br>
<br>
<table width="191" height="20" border="0" align="center" background="layout/bars/djoftheweek_bar.png">
<tr>
<td><div align="center"></div></td>
</tr>
</table>
<img src="layout/bars/middle_bar.png" width="191" height="4" align="top">
<table width="191" border="0" background="layout/bars/content_bar.png">
<tr>
<td align="center" valign="top"><div align="center"><script type="text/javascript">
//<![CDATA[
window.onload = function() {
var f = document.getElementById("djoftheweek");//Sets iframe id
function resize() { //Starts resize function
var h = "";
var w = "";
if (f.contentDocument) {
h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
// can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
} else if (f.contentWindow) {
h = f.contentWindow.document.body.scrollHeight + 5 + "px";
} else {
return;
}
f.setAttribute("height",h);
f.parentNode.setAttribute("height",h);
}
if (window.addEventListener) {
f.onload = resize;
} else if (f.attachEvent) {
f.attachEvent("onload", resize);
} else {
return;
}
resize(); //starts resize function that was coded further up the code
}
//]]>
</script><iframe name="djoftheweek" id="djoftheweek" src="pages/djoftheweek.htm" width="100%" frameborder="0" allowtransparency="yes" scrolling="No"></iframe>
</div></td>
</tr>
</table>
<img src="layout/bars/bottom.png" width="191" height="5" align="top"></div>
<div align="center"></div></td>
<td align="center" valign="top"><div align="center"><script type="text/javascript">
//<![CDATA[
window.onload = function() {
var f = document.getElementById("content");//Sets iframe id
function resize() { //Starts resize function
var h = "";
var w = "";
if (f.contentDocument) {
h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
// can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
} else if (f.contentWindow) {
h = f.contentWindow.document.body.scrollHeight + 5 + "px";
} else {
return;
}
f.setAttribute("height",h);
f.parentNode.setAttribute("height",h);
}
if (window.addEventListener) {
f.onload = resize;
} else if (f.attachEvent) {
f.attachEvent("onload", resize);
} else {
return;
}
resize(); //starts resize function that was coded further up the code
}
//]]>
</script><iframe name="content" id="content" src="pages/home.htm" width="100%" frameborder="0" allowtransparency="yes" scrolling="No"></iframe>
</div></td>
<td width="195" align="center" valign="top"><div align="center" class="style3">
<table width="191" height="20" border="0" align="center" background="layout/bars/poll_bar.png">
<tr>
<td><div align="center"></div></td>
</tr>
</table>
<img src="layout/bars/middle_bar.png" width="191" height="4" align="top">
<table width="191" border="0" background="layout/bars/content_bar.png">
<tr>
<td height="14"><div align="center"><script type="text/javascript">
//<![CDATA[
window.onload = function() {
var f = document.getElementById("poll");//Sets iframe id
function resize() { //Starts resize function
var h = "";
var w = "";
if (f.contentDocument) {
h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
// can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
} else if (f.contentWindow) {
h = f.contentWindow.document.body.scrollHeight + 5 + "px";
} else {
return;
}
f.setAttribute("height",h);
f.parentNode.setAttribute("height",h);
}
if (window.addEventListener) {
f.onload = resize;
} else if (f.attachEvent) {
f.attachEvent("onload", resize);
} else {
return;
}
resize(); //starts resize function that was coded further up the code
}
//]]>
</script><iframe name="poll" id="poll" src="pages/poll.htm" width="100%" frameborder="0" allowtransparency="yes" scrolling="No"></iframe>
</div></td>
</tr>
</table>
<img src="layout/bars/bottom.png" width="191" height="5" align="top"><br>
<br>
<table width="191" height="20" border="0" align="center" background="layout/bars/listenerrecord_bar.png">
<tr>
<td><div align="center"></div></td>
</tr>
</table>
<img src="layout/bars/middle_bar.png" width="191" height="4" align="top">
<table width="191" border="0" background="layout/bars/content_bar.png">
<tr>
<td valign="top"><div align="center">Listener Record - Don't <br>
use a iFrame</div></td>
</tr>
</table>
<img src="layout/bars/bottom.png" width="191" height="5" align="top"><br>
<br>
<table width="191" height="20" border="0" align="center" background="layout/bars/radio_bar.png">
<tr>
<td><div align="center"></div></td>
</tr>
</table>
<img src="layout/bars/middle_bar.png" width="191" height="4" align="top">
<table width="191" border="0" background="layout/bars/content_bar.png">
<tr>
<td height="14" align="center" valign="top"><div align="center"><script type="text/javascript">
//<![CDATA[
window.onload = function() {
var f = document.getElementById("radio");//Sets iframe id
function resize() { //Starts resize function
var h = "";
var w = "";
if (f.contentDocument) {
h = f.contentDocument.documentElement.offsetHeight + 20 + "px";
// can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");
} else if (f.contentWindow) {
h = f.contentWindow.document.body.scrollHeight + 5 + "px";
} else {
return;
}
f.setAttribute("height",h);
f.parentNode.setAttribute("height",h);
}
if (window.addEventListener) {
f.onload = resize;
} else if (f.attachEvent) {
f.attachEvent("onload", resize);
} else {
return;
}
resize(); //starts resize function that was coded further up the code
}
//]]>
</script><iframe name="radio" id="radio" src="pages/radio.htm" width="100%" frameborder="0" allowtransparency="yes" scrolling="No"></iframe>
</div></td>
</tr>
</table>
<img src="layout/bars/bottom.png" width="191" height="5" align="top"></div></td>
</tr>
</table>
<img src="layout/bars/bottomcontent.png" width="888" height="5">
<table width="888" height="45" border="0" background="layout/bars/newbottom.png">
<tr>
<td>&nbsp;</td>
</tr>
</table>
</div>
</body>
</html>

+Rep for help, ty! Oh, btw guys do not steal this layout, its been copyrighted, with a site.

Blob
17-08-2009, 04:11 PM
Why would we want to rip that?
Find out your self, your getting payed for it
Its in tables
Your using iframes
Learn to code
Thanks

Mickword
17-08-2009, 04:48 PM
Erm,
1. *Removed*
2. they wanted it in tables
3. yes iframes, all sites use it
4. i have learnt to code
5. - rep

Edited by Catzsy [Forum Super Moderator]: Please do not rude to other members. Thanks.

Blob
17-08-2009, 04:56 PM
Erm,
1. shut your face
2. they wanted it in tables
3. yes iframes, all sites use it
4. i have learnt to code
5. -rep


Okay, but what about my mouth?
Good for them, but you should learn to code with css + div's
deviantart doesn't, habboxforum doesn't.
Err no.
Have that -rep back :)

Fehm
17-08-2009, 04:59 PM
Erm,
1. shut your face
2. they wanted it in tables
3. yes iframes, all sites use it
4. i have learnt to code
5. -rep

1. Grow up

2. Well thats just stupid
3. Wrong. Not all sites use it at all. Its on the fast decline.
4. PMSL:LOL:ROFL:LMAO: PERIOD.
5. Give me some pleasee? =D

Edited by Catzsy [Forum Super Moderator]: Please do not post just to potentially cause an argument. Thanks.

Mickword
17-08-2009, 05:21 PM
Hey look its my good friend -.-, in future stay out of it.

Edited by Catzsy [Forum Super Moderator]: Please stay on-topic. Thanks.

Fehm
17-08-2009, 05:30 PM
No. I am a user of this forum, I have a right to post in any thread I can view. kthxbai xox

Edited by Catzsy [Forum Super Moderator]: Please stay on-topic. Thanks.

Calvin
17-08-2009, 05:41 PM
Seriously, if you can't do iframes then just give them they're money back and tell them to find someone else...

Pazza
17-08-2009, 06:27 PM
Why would we want to rip that?
Find out your self, your getting payed for it
Its in tables
Your using iframes
Learn to code
Thanks

Agree


Erm,
1. shut your face
2. they wanted it in tables
3. yes iframes, all sites use it
4. i have learnt to code
5. -rep
Disagree



Okay, but what about my mouth?
Good for them, but you should learn to code with css + div's
deviantart doesn't, habboxforum doesn't.
Err no.
Have that -rep back :)

Agree


1. Grow up.
2. Well thats just stupid
3. Wrong. Not all sites use it at all. Its on the fast decline.
4. PMSL:LOL:ROFL:LMAO: PERIOD.
5. Give me some pleasee? =D
Agree


No. I am a user of this forum, I have a right to post in any thread I can view. kthxbai xox
Agree


Seriously, if you can't do iframes then just give them they're money back and tell them to find someone else...
Agree

Fehm
17-08-2009, 06:37 PM
Mate. ITS NOT JUST MEEEEEEE THATS AGAINST YOU!

So like... YH!

Edited by Catzsy [Forum Super Moderator]: Please do not target a member in a way that can be considered by others as bullying.

Jahova
18-08-2009, 08:05 AM
Sorry, iFrames are simple stuff - If you can't do them then.. :rolleyes:

BigAlan
18-08-2009, 08:13 AM
To help keep your code clean use indents and place your css in external files along with your javascript!

Then try migrating to using div's and not tables (tables are for tabular data, NOT website layout!).

Back on the iframes subject yes you can use iframes but I recommend not to use them as they can become very confusing, and basically they are horrible.. its just so much easier not to use them. You could even use PHP includes as a much better way!

Hope that helps,

Alan.

Want to hide these adverts? Register an account for free!