Jump to content

What is wrong with my script?


EdTheNerd
 Share

Recommended Posts

I am having a problem with the Home() function I wrote in the script at the bottom. It works nicely with some things assigned to document.getElementById('defbardef').innerHTML, but others stop the whole page from functioning. I want to assign the following to document.getElementById('defbardef').innerHTML :<h2>An introduction to Ed</h2><p>A scripter, programmer, web developer and nerd, Ed rejects the insanity that is the social norm and instead concentrates on sensible people, their views and his projects. This has lead many to the belief that Ed is antisocial, although this is a misconception; it is simply that many people are antisocial towards him. Fortunately, he finally has a life and some friends, thus his social capacity has not diminished to that of a JavaScript form validator.</p><h2>Philosophy</h2><div id="signInForms"><fieldset><legend>Sign up</legend><form action="createNewAccount.php" method="post"><table><tr><td><lable for="name">Name</label></td><td><input type="name" value="insert name here" name="name" /></td></tr><tr><td><lable for="password">Password</label></td><td><input type="password" name="password" /></td></tr><tr><td><lable for="passwordConfirm">Confirm Password</label></td><td><input type="password" name="passwordConfirm" /></td></tr><tr><td></td><td><input type="submit" value="Sign up" /></td></tr></table></form></fieldset></div><p>Ed believes in a mixture of activity and laziness; he believes that you should do what the ###### you like, but it's probably a good idea to have some awesome projects and a means of recording one's knowledge to organise one's mind.<p>As you can see, he believes that you should speak in any manor that you wish; if you like to swear, use the pronoun 'one' or use long words, so be it; these are all useful means of expression.</p><p>He does not believe that any thought is a crime, unlike most of the population, who like to persecute others for just this.</p><p>He despises self-delusion and acknowledges the damage that it can do to people.</p><p>He believes that most people are in far worse mental health states than they could be if society wasn't so rejecting and harrassing to anyone who seems slightly different or has some problem, not to say that difference is a problem.</p><p>He endorses beneficial eccentricities and sees them as rebellion from the insanity that has become the social norm.</p><p>He admires the wonders that have been achieved by means of collaborative authoring, and points you towards the wikimedia foundation for a prime example of this.</p><p>He is a realist and believes that inducing thoughts and beliefs that one would not naturally think is both highly unlikely to be successful, dangerous and a form of procastrination.</p><p>Finally and most importantly, he is a <a href="http://en.wikipedia.org/wiki/Hedonism">hedonist</a>; this means that he believes that both the happiness of one's self and that of others are sensible aims and that ridgid morals hinder this, therefore are iniquitous.</p><h2>Where to now?</h2><p>Explore! Use the navigation bar at the top to discover the world of Ed's site! Sections you might wish to get your teeth into are the archive and the forum, which you will be allowed to post on if you acquire membership, which can be done with the form above.</p>I tried putting it all one one line (notepad wrapped it a little, even though text wrap was off).I tried using .innerHTML='' instead of .innerHTML="" and even putting a '/' before the appostraphes in the HTML to go in.:-(Here is the web page:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>Ed</title><script type="text/JavaScript" language="JavaScript1.3" src="standard.js"></script><link rel="stylesheet" href="default_style.css" type="text/css" /></head><body><div class="header"><h1>Ambitious, Eccentric Ed - The Autobiography</h1><ul class="navigation" id="zeroth"><li class="topBar" onClick="Home()" onmouseOver="HoverHome()">Home</li><li class="topBar" onmouseOver="HoverPreferences()">My preferences</li><li class="topBar" id="hide_left_navpane" onmouseOver="HoverHideLeftNavpane()" onclick="HideLeftNavpane()">Hide left navpane</li><li class="topBar" onmouseOver="HoverFriend_sites()">Friends' Sites</li><li class="topBar" onmouseOver="HoverDCom()">DCom</li><li class="topBar" onclick="Help()" onmouseOver="HoverHelp()">Help</li></ul><ul class="navigation" id="primary"><li class="topBar">Who he is</li><li class="topBar">What he does</li><li class="topBar">Achievements/Boasting</li><li class="topBar">Forum</li><li class="topBar">Articles</li></ul><div id="defbar"><h3 id="defbarterm"></h3><p id="defbardef"></p></div></div><div id="LeftBar"><ul id="Articles"><li>PCs</li><ul><li>Website Design</li><li>Programming (see website design for JavaScript and PHP)</li><li>Gaming</li></ul><li>Politics and Current Affairs</li><ul><li>Terrorism</li><li>Political Systems</li></ul><li>Philosophy</li><ul><li>Epistemlogical Realism vs. Epistemological Idealism</li></ul><li>Religion</li><ul><li>It's okay to disrespect religion</li><li>Why Atheism</li><li>Buddhism</li></ul><li>Psychology</li><ul><li>Rhetoric as a form of brainwashing</li></ul><li>Other</li><li>Contact me</li></ul></ul></div><div id="infoBox"><h2>An introduction to Ed</h2><p>A scripter, programmer, web developer and nerd, Ed rejects the insanity that is the social norm and instead concentrates on sensible people, their views and his projects. This has lead many to the belief that Ed is antisocial, although this is a misconception; it is simply that many people are antisocial towards him. Fortunately, he finally has a life and some friends, thus his social capacity has not diminished to that of a JavaScript form validator.</p><h2>Philosophy</h2><div id="signInForms"><fieldset><legend>Sign up</legend><form action="createNewAccount.php" method="post"><table><tr><td><lable for="name">Name</label></td><td><input type="name" value="insert name here" name="name" /></td></tr><tr><td><lable for="password">Password</label></td><td><input type="password" name="password" /></td></tr><tr><td><lable for="passwordConfirm">Confirm Password</label></td><td><input type="password" name="passwordConfirm" /></td></tr><tr><td></td><td><input type="submit" value="Sign up" /></td></tr></table></form></fieldset></div><p>Ed believes in a mixture of activity and laziness; he believes that you should do what the ###### you like, but it's probably a good idea to have some awesome projects and a means of recording one's knowledge to organise one's mind.<p>As you can see, he believes that you should speak in any manor that you wish; if you like to swear, use the pronoun 'one' or use long words, so be it; these are all useful means of expression.</p><p>He does not believe that any thought is a crime, unlike most of the population, who like to persecute others for just this.</p><p>He despises self-delusion and acknowledges the damage that it can do to people.</p><p>He believes that most people are in far worse mental health states than they could be if society wasn't so rejecting and harrassing to anyone who seems slightly different or has some problem, not to say that difference is a problem.</p><p>He endorses beneficial eccentricities and sees them as rebellion from the insanity that has become the social norm.</p><p>He admires the wonders that have been achieved by means of collaborative authoring, and points you towards the wikimedia foundation for a prime example of this.</p><p>He is a realist and believes that inducing thoughts and beliefs that one would not naturally think is both highly unlikely to be successful, dangerous and a form of procastrination.</p><p>Finally and most importantly, he is a <a href="http://en.wikipedia.org/wiki/Hedonism">hedonist</a>; this means that he believes that both the happiness of one's self and that of others are sensible aims and that ridgid morals hinder this, therefore are iniquitous.</p><h2>Where to now?</h2><p>Explore! Use the navigation bar at the top to discover the world of Ed's site! Sections you might wish to get your teeth into are the archive and the forum, which you will be allowed to post on if you acquire membership, which can be done with the form above.</p></div></body></html>Here is the stylesheet:body {font-family: verdana, arial, arial narrow; color: rgb(0,0,0); margin: 0; padding: 0; border: 0; background-color: rgb(220,220,255)}.header {text-align: center; width: 100%; background-color: black}.navigation {font-family: Calligraph421 BT, fine hand; color: rgb(150,150,256); background-color: black; width: 100%}li.topBar {display: inline; padding: 2em}#LeftBar {margin-right: 2em; display: block; padding: 0; font-family: Caligraph421BT; color: white; background-color: black; width: 39%; float: left; height: 100em}#infoBox {padding-left: 2em; padding-right: 2em; padding-bottom: 2em; padding-top: 1em}h1 {font-family: Calligraph421 BT, fine hand; color: rgb(255,255,255); font-weight: 100}fieldset {width: 39%; float: left; margin-right: 0.5em}#defbar {font-family: Calligraph421 BT, fine hand, vladimir script, comic sans; color: rgb(255,255,180); text-align: left; padding-left: 1em; background-color: rgb(32,32,64)}#defbarterm {display: inline; padding-right: 1em}#defbardef {display: inline}ul {list-style-type: none}li {padding-bottom: 1em; padding-top: 1em}Here is the java script:var navdisp;function HideLeftNavpane(){if(navdisp==true || navdisp==null){document.getElementById('LeftBar').style.display="none";document.getElementById('hide_left_navpane').innerHTML="Show left navpane";navdisp=false;}else{document.getElementById('LeftBar').style.display="block";document.getElementById('hide_left_navpane').innerHTML="Hide left navpane";navdisp=true;}}function HoverHideLeftNavpane(){document.getElementById('defbarterm').innerHTML="Hide Left Navpane:";document.getElementById('defbardef').innerHTML="Hide the big black navigation panel on the left."}function HoverHome(){document.getElementById('defbarterm').innerHTML="Home:";document.getElementById('defbardef').innerHTML="Probably the first page you visited on this site, home introduces you to Ed and his philosophy. You can also sign in here.";}function Home(){document.getElementById('infoBox').innerHTML=}function HoverPreferences(){document.getElementById('defbarterm').innerHTML="Preferences:";document.getElementById('defbardef').innerHTML="Alter preferences with Ed's brilliant cookie creater to ensure that you get concise, relevant information presented in a format of your choice.";}function HoverHelp(){document.getElementById('defbarterm').innerHTML="Help:";document.getElementById('defbardef').innerHTML="Click on the icon you just hovered your mouse over to view a help article in the light blue box."}function Help(){document.getElementById('infoBox').innerHTML="<h2>Help</h2><p>Don't panic - Help is here!</p><p>This site behaves differently to most sites and that is intentional - I hate the interface of most sites. Instead of clciking on links to navigate, you simply click on text, resulting in a much faster response. Think of this site as a program on your computer; you do not keep requesting information from the server.</p><p>You should see two lines of text at the top. Hovering the mouse over one of the pieces of these will make a definition appear in a blue bar just below the top black region.</p><p>Clicking on one of these will make them carry out their main task, which is likely to be to make text appear in this box.</p><p>Clicking on one of the items on the left navigation bar will display something in the blue area, also.</p><p>DO NOT CLICK REFRESH ON YOUR BROWSER WHEN ON THIS SITE< AS THIS WILL LOSE THE SECTION YOU ARE ON.</p><h2>Further Questions</h2><p>Got any further questions? Contact me with guyattec@aol.com</p>";}function HoverDCom(){document.getElementById('defbarterm').innerHTML="DCom (coming soon):";document.getElementById('defbardef').innerHTML="A wide range of communication services such as instant messaging, chat rooms and a personal messaging sevice, all closely linked to provide a dynamic communication experience.";}function HoverMyspace(){document.getElementById('defbarterm').innerHTML="Ed's MySpace:";document.getElementById('defbardef').innerHTML="Hosted on website with blogs, profiles and instant messaging, mySpace is deemed by many a great place to mix and chat.";}function HoverH2G2(){document.getElementById('defbarterm').innerHTML="The Hitch Hiker's guide to the Galaxy";document.getElementById('defbardef').innerHTML="The guide to ,life, the universe and everything, this site is my favourite collaborative authoring site, providing many fascinating topics presented in a humourous yet generally academic fashion.";}function HoverFriend_sites(){document.getElementById('defbarterm').innerHTML="Friends' sites:";document.getElementById('defbardef').innerHTML="Meet Jake, Ell, Arvin et al - visit their mighty sites!";}Thanks,Ed

Link to comment
Share on other sites

function Home(){document.getElementById('infoBox').innerHTML=}

Maybe I am missing something here, but what does 'infobox' get changed to? You might want to pass a parameter into the function if the value to change 'infobox' to varies. Such as calling it like:

Home("Text to change to goes here")

Then having your function like:

function Home(changeTo){document.getElementById('infoBox').innerHTML=changeTo;}

edit: With a little further abstraction you could have the function apply to any element. Example of calling the function:

UpdateText(this.id, "text you want to change element to")

The first parameter in the above code will pass the elements id into the function so it can be used generically for any element. Then your function to update text would be like this:

UpdateText(id, changeTo){	 document.getElementById(id).innerHTML=changeTo;}

Hope it helps :)

Link to comment
Share on other sites

<h2>An introduction to Ed</h2><p>A scripter, programmer, web developer and nerd, Ed rejects the insanity that is the social norm and instead concentrates on sensible people, their views and his projects. This has lead many to the belief that Ed is antisocial, although this is a misconception; it is simply that many people are antisocial towards him. Fortunately, he finally has a life and some friends, thus his social capacity has not diminished to that of a JavaScript form validator.</p><h2>Philosophy</h2><div id="signInForms"><fieldset><legend>Sign up</legend><form action="createNewAccount.php" method="post"><table><tr><td><lable for="name">Name</label></td><td><input type="name" value="insert name here" name="name" /></td></tr><tr><td><lable for="password">Password</label></td><td><input type="password" name="password" /></td></tr><tr><td><lable for="passwordConfirm">Confirm Password</label></td><td><input type="password" name="passwordConfirm" /></td></tr><tr><td></td><td><input type="submit" value="Sign up" /></td></tr></table></form></fieldset></div><p>Ed believes in a mixture of activity and laziness; he believes that you should do what the ###### you like, but it's probably a good idea to have some awesome projects and a means of recording one's knowledge to organise one's mind.<p>As you can see, he believes that you should speak in any manor that you wish; if you like to swear, use the pronoun 'one' or use long words, so be it; these are all useful means of expression.</p><p>He does not believe that any thought is a crime, unlike most of the population, who like to persecute others for just this.</p><p>He despises self-delusion and acknowledges the damage that it can do to people.</p><p>He believes that most people are in far worse mental health states than they could be if society wasn't so rejecting and harrassing to anyone who seems slightly different or has some problem, not to say that difference is a problem.</p><p>He endorses beneficial eccentricities and sees them as rebellion from the insanity that has become the social norm.</p><p>He admires the wonders that have been achieved by means of collaborative authoring, and points you towards the wikimedia foundation for a prime example of this.</p><p>He is a realist and believes that inducing thoughts and beliefs that one would not naturally think is both highly unlikely to be successful, dangerous and a form of procastrination.</p><p>Finally and most importantly, he is a <a href="http://en.wikipedia.org/wiki/Hedonism">hedonist</a>; this means that he believes that both the happiness of one's self and that of others are sensible aims and that ridgid morals hinder this, therefore are iniquitous.</p><h2>Where to now?</h2><p>Explore! Use the navigation bar at the top to discover the world of Ed's site! Sections you might wish to get your teeth into are the archive and the forum, which you will be allowed to post on if you acquire membership, which can be done with the form above.</p>

Link to comment
Share on other sites

I tried using .innerHTML='' instead of .innerHTML="" and even putting a '/' before the appostraphes in the HTML to go in.
You could try putting the text in single quotes again, double quotes wouldent work because of the content, and using: '\' as the escape character before apostrophes. I don't know if it would work, but I think you got the escape character the wrong way round last time.
Link to comment
Share on other sites

Different problem: It's not displaying correctly in IE7Scroll to the right and you'll see some red things sticking out. Also, it's shifted the bullet points to the left in some places.And it seems that some bullet points have gone further to the right of the navigation pane than others, which have still spanned two lines.http://hometown.aol.com/guyattecThanks,Ed

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...