HTML - Simple Javascript Code Not Working
hello i am new to javascript and i can't figure out why this code will not sort the user's line of text into alphabetical order. any help would be great thank you
Code: <html> <head> <title> JavaScript array sort() alphabetically </title> <script type="text/javascript"> var arr = new Array(1); arr[1]=prompt("enter a line of text") document.write("Original Array is: "+arr+"<br>"); document.write("Sorted array is: "+arr.sort()+"<br> "); </script> </head> </body> </html> Similar TutorialsI'm new to html and ftp, and I inputted some html from the godaddy ftp that should work and it's not working but just showing the html language. on the page I titled the file index.html, but it's still not working. Go here please: http://animalcon.com/ Any suggestions? thanks -Nate Hi. Could someone take a look at this site for me please. http://www.sussexweddingphotography.org.uk I have basic knowledge. Currently problems with IE8 as you will see. Firefox looks okay. Getting probs with resolution too, objects positioning all over the place, esp.. on my notebook Easy fix I am sure, but Im muddling my way through it... Thanx in advance Hi I found a simple redirect script, but it's not forwarding to the page it says it is - it just stays on the same page. What am I doing wrong? http://www.gilbert.net.au I used youtube as a sample redirect page, because I know it will load once I get the script right. Cheers for your help. Shaun Hello there. I have a question regarding a simple html table code I made. My problem is, that when using it at livejournal.com as a profile layout, it shows up like this: BUT when I open it with FireFox it looks like this, and this is way it is supossed to look like: And here is the code for it: Code: <table width="500" height="704" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="246" height="704" background="http://img696.imageshack.us/img696/1996/border1.png"></td> <td width="245" height="704" valign="top" background="http://img266.imageshack.us/img266/1804/border2.png"> <div align="right"><font face="garamond" color="#8998a6" size="6">❝<b><i>your title here</i></b>❞</font></div><br><br> <div align="left"><font face="garamond" color="#8998a6" size="3">❥<i>your title here</i></font></div> <div align="left"><font face="trebuchet ms" color="#000000" size="1">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</font></div> <br><div align="right"><font face="garamond" color="#8998a6" size="3">❥<i>your title here</i></font></div> <div align="right"><font face="trebuchet ms" color="#000000" size="1">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</font></div> <br><div align="left"><font face="garamond" color="#8998a6" size="3">❥<i>your title here</i></font></div> <div align="left"><font face="trebuchet ms" color="#000000" size="1">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate.</font></div> <br><br><div align="center"><font face="garamond" color="#8998a6" size="1"><a href="LINKHERE"><font face="trebuchet ms" color="#62130e" size="1">link1</font></a> // <font face="garamond" color="#62130e" size="1"><a href="LINKHERE"><font face="trebuchet ms" color="#62130e" size="1">link2</font></a> // <font face="garamond" color="#8998a6" size="1"><a href="LINKHERE"><font face="trebuchet ms" color="#62130e" size="1">link3</font></a> // <font face="garamond" color="#8998a6" size="1"><a href="http://kessha.livejournal.com/"><font face="trebuchet ms" color="#62130e" size="1">profile</font></a></td <td width="14" height="704" background="http://img257.imageshack.us/img257/3012/border3g.png"</td> </tr> </table> Where is the error? I cant seem to find it, nor the reason why it shows up so differently when using it on livejournal. Thanks! I'm not good at writing HTML code, but I'm sure this is a simple problem. I have one background image on top repeating horizontally but would like another that shows up below it... basically one that repeats both horizontally and vertically but doesn't cover up the previous code. My second background is called: backtexture.PNG If you could modify the code I have, I'd GREATLY appreciate it... and THANK YOU in advance! ---------------------------------------------------------------------------- <img src="back.PNG"> <style><body marginheight="0" marginwidth="0"> <STYLE TYPE="text/css"> <!-- BODY {margin: 0} ---> <style> html { overflow-x: hidden; overflow-y: auto; } </style> <style type="text/css"> body { background-image: url("backtp.PNG"); background-position:Top Center; background-attachment:scroll; background-repeat:repeat-x; } </style> Please read before moving to different forum. I feel the MP3 player is not the issue... I have an MP3 that is available to be played when the index page is loaded - users choice - works great. My situation is that I would like to have some text displayed over the activex control. The control and the text should always be displayed in the CENTER of the page, with the text (something like "Our Theme") tightly displayed & centered over top. I figured it is either extremely simple, or impossible. My current EMBED SRC is shown below. HTML Code: <span style="position: absolute; left:410; top:135"> <EMBED SRC="LittleGTO.mp3" autostart="false" VOLUME="50" HEIGHT="25" WIDTH="175"></span> Any help y'all can offer would be greatly appreciated. Bob Hello, I have a link on my homepage to another page of mine but I don't want the spiders to follow the link and index that page and the pages in it. Is there a simple way to fix this? I've heard of a "No Follow" thing but not sure if thats what I need or how to write it. Thanks. Hello, i would like a code that would allow one user at a time to enter ONE word into a box and submit, once its submitted the word is put on the page, in order so it creates a sort of story. Any help is good!! Hi guys, I have on my webhost a ton of pictures and I would like to be able to go to that directory... xxx.com/photos ...and have a page display all the files located in that directory just in a list....then be able to click on them so it displays. Just a file list basically. eg: pic1.jpeg pic2.jpeg etc Is there a simple code to allow me to do this? Thanks! Hi ! Found this code below in this HTML section.( How to make images & text boxes line up.) Thanks Coothead, but needs a "table" apparently. Need ( 6, say ) thumbnails across the page. Space around. Then, underneath, same again - and so on. Like a chess board This code brings up the FULL size image, in line across. Please could you add what is needed? Then I could use it as a template (?) and tweek the sizes (?) No text required. <table> <tr> <td><img src="pic1.gif"></td> <td><img src="pic2.gif"></td> </tr> </table> Thank you in advance for any help - Hi . Here is my script HTML Code: <table width="200" border="0"> <tr> <td><span class="style2"> <input name="button" type="button" onclick="show('Hello')" value="Button 1" /> </span></td> </tr> <tr> <td><span class="style2"> <input name="button22" type="button" onclick="show('Goodbye')" value="Button 2" /> </span></td> </tr> <tr> <td><span class="style2"> <input name="button23" type="button" onclick="show('Good Morning')" value="Button 3" /> </span></td> </tr> <tr> <td><span class="style2"> <input name="button2" type="button" onclick="show('Goodnight')" value="Button 4" /> </span></td> </tr> </table> <p class="style2"> </p> <p class="style2"> <textarea name="textarea" cols="50" rows="10" readonly id="area"> </textarea> In the areas where it says, for example ="show('Goodnight')", how do I add HTML code in the brackets but as normal text? At the moment it is trying to read it as HTML code but I want it to be displayed as text. How would I accomplish this. It is probably pretty simple but I am a bit of a noob Thanks I've been battling this for over a week and still can't figure out how to fix it. The page in question is he http://www.vivation.com/test3/ On the bottom right hand "purple" area is displayed 'Workshops & Course Offerings", followed by a list of class offerings. This was done using the following "example" positional code: Code: <DIV style="position: absolute; top: 320px; left: 300px;"> <p align="left" class="workshopheader"><strong> <font color="#FFCC00">Workshop & Course Offerings</font></strong></p> </DIV> As you can see it looks great in both Firefox and Safari, but does not show up *at all* in IE. I have no idea why not, and thus no idea how to correct it so it will show up in all browsers. Any help or insights would be most appreciated! I have tried, unsucessfully, to create a form that gives options and choices and then a grand total at the end. Someone with more ideas might see my errors and hopefully get me back on track... I don't know how to get a different answer by someone selecting a different choice or option, and lord knows how to get the total to happen at the bottom of the page. I tried to read, but no answers seem to fit. Thank you for your time and talent, Here is my code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Machine Quilting Work Sheet2</title> </head> <body> <p> <p> <form method="POST" action="--WEBBOT-SELF--" name="test" onSubmit=""> <!--webbot bot="SaveResults" startspan U-File="_private/form_results.txt" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><strong>[FrontPage Save Results Component]</strong><!--webbot bot="SaveResults" endspan --> <p>Enter Width: <INPUT NAME="Product_Quilt_Width" SIZE=5> Enter Length: <INPUT NAME="Product_Quilt_Length" SIZE=5><p> Add 8 inches to the Width to get the Minimum Width <input name="Product_Batting_Width" onblur="document.test.Product_Batting_Width.value = document.test.Product_Quilt_Width.value*1 + 8;" size="5"></p> <p> Multiply Quilt Width by Quilt Length to get the Total Square Inches <input type=text name=Total_Square_Inches onblur="document.test.Total_Square_Inches.value = document.test.Product_Quilt_Width.value * document.test.Product_Quilt_Length.value;" size="10"> </p> <p> <input type="radio" value="Total Square Inches x $.02" name="Choice1"> Choice costs Total Square Inches x $.02</p> <p> <input type="radio" value="Total Square Inches x $.03" checked name="Choice2"> Choice costs Total Square Inches x $.03</p> <p>Total Square Inches Multiplied by $.02 <input type=text name=Total_Square_Inch_cost onblur="document.test.Total_Square_Inch_cost.value = document.test.Total_Square_Inches.value * .02;" size="10"> </p> <p>Total of Choice selection <input type="text" name="Choice_Selection_Total" size="20"> </p> <p>Total Square Inches Multiplied by Choice option <input type="text" name="T1" size="20"> </p> <p><select size="1" name="Binding"> <option selected value="$6.00">Binding_Cost</option> <option>No Binding</option> <option value="$10.00">Binding All</option> </select> Binding cost add into Total Cost </p> <p>Grand Total Cost <input type="text" name="Grand_Total_Cost" size="10" onblur="document.test.Total_Cost.value = document.test.Total_Square_Inch_cost.value + document.test.Binding.value;" size="10"> </p> <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> </form> <p> </p> </body> I'm stumped on this one. I've got code that runs fine in all browsers other than IE7. Here's the kicker, the page displays DIFFERENTLY every time I load it up in IE7. Sometimes it shows up correctly, sometimes the elements appear stacked. I've never heard of this happening, and the only variable I can think of was the order in which the elements loaded, so I built a pre-loader in to the index page, but still no luck. Elements load differently sometimes. Any help?? The page is live at: http://milesmediation.com/mediators_main.html The part that is appearing differently is in an i-frame, the html for that is http://milesmediation.com/mediators_home.html Thank you for any help, I'm stumped on this one!! hi i have this code done up it seems to work internally but does not work externally when i send it to someone else. any ideas why this is here is the code Code: <body> <form action="mailto:joebloggs@gmil.com" method="POST" enctype="multipart/form-data" name="EmailTestForm"> <img height="70" border="0" width="400" usemap="#locations" src="http://www.harvest-financial.ie/Contact_Us/upload/Image/harvestlogo.jpg" </br> <br> <br> <INPUT type="radio" name="Answer" value="Yes I am interested in a meeting. Please contact me to arrange a meeting">Yes I am interested in a meeting. Please contact me to arrange a meeting<BR> <INPUT type="radio" name="Answer" value="No I do not require a meeting"> No I do not require a meeting<BR> <INPUT type="radio" name="Answer" value="Yes I am interested in a meeting but at a later date. Please contact me in a months time">Yes I am interested in a meeting but at a later date. Please contact me in a months time<BR> </br> </br> </br> <div align="center"><input type="submit" value="Submit"></div> </body> Hey everyone, I am new to HTML-CSS-etc. and I have a problem. When I am building my page within Dreamweaver and preview it in my browser-my CSS dropdown menu works fine. Then I import everything(files/directories) onto my FTP server and make it go live on my site. When I make it live on my site, everything shows, except the CSS menu bars DO NOT drop down or do anything. Here is the snip of the code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>MahaRaja_RedRedeux</title> <link rel="icon" href="templates/fav.gif" type="image/x-icon"> <script language="JavaScript" type="text/javascript"> //<![CDATA[ <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> //]]> </script> <script type="text/javascript" src="required/popmenu.js"> </script> <style type="text/css"> /*<![CDATA[*/ <!-- @import url('required/maharaja.css'); @import url('required/maharaja-menus.css'); --> /*]]>*/ </style> <style type="text/css"> /*<![CDATA[*/ li.c1 {width:89px;} /*]]>*/ </style> <link href="required/maharaja-menus.css" rel="stylesheet" type="text/css"> </head> Does anyone see anything wrong here? Hi, I ran a code validation on my site (www.improvizations.com), it came back with 11 errors. Many of them look like this: Line 9, Column 31: there is no attribute "leftmargin". <body topmargin="0" leftmargin="0" marginwidth="0" rightmargin ="0" marginheight and this: Line 15, Column 43: required attribute "alt" not specified. <div id="logo"><img src="images\logo.gif" /></div> How do I fix this? Also, my site looks fine in IE but awful in Firefox. What's going on? Any help would be greatly appriciated. I'm a newbie with all of this. Thanks!! I have the following code, and it only works in Internet Explorer and Netscape, but I need it to work with those and firefox and opera. HTML Code: <style> body {background: #555555; font-family: arial; margin: 20;} table.body {width: 85%; height: 100%;} td.body {background: #fcfcfc;} table.nav {width: 200; border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black;} td.navbuttonhead {background: url(assets/images/structure/fadebar.png); border-bottom: 1px solid #191919; color: white;} td.navbuttonoff {background: #6a6a6a; border-bottom: 1px solid #191919; border-top: 1px solid #8A8A8A;} td.navbuttonon {background: #8C8C8C; border-bottom: 1px solid #191919; border-top: 1px solid #8A8A8A;} td.navbuttonofftop {background: #6a6a6a; border-bottom: 1px solid #191919;} td.navbuttonontop {background: #8C8C8C; border-bottom: 1px solid #191919;} td.bodyleft {width: 12; background: url(assets/images/structure/bodybgleft.png); border-right: 1px solid black;} td.bodyright {width: 12; background: url(assets/images/structure/bodybgright.png); border-left: 1px solid black;} a.navbutton {text-decoration: none; color: white;} img {border: none;} a.link {color: #404040; text-decoration: none;} a.link:hover {color: #404040; text-decoration: underline;} </style> <table class="nav" cellspacing="0" cellpadding="2" style="margin-bottom: 4;" id="tableCollapsed1" style="display: none;"> <tr> <td class="navbuttonhead"> <a href="#" class="navbutton" onclick="collapse(1)"><div>Test</div></a> </td> </tr> </table> <table class="nav" cellspacing="0" cellpadding="2" style="margin-bottom: 4;" id="tableExpanded1"> <tr> <td class="navbuttonhead"> <a href="#" class="navbutton" onclick="expand(1)"><div>Test</div></a> </td> </tr> <tr> <td class="navbuttonofftop" onmouseover="className='navbuttonontop'" onmouseout="className='navbuttonofftop'"> <a href="#" class="navbutton"><div style="padding-left: 2;">Text</div></a> </td> </tr> <tr> <td class="navbuttonoff" onmouseover="className='navbuttonon'" onmouseout="className='navbuttonoff'"> <a href="#" class="navbutton"><div style="padding-left: 2;">Text</div></a> </td> </tr> <tr> <td class="navbuttonoff" onmouseover="className='navbuttonon'" onmouseout="className='navbuttonoff'"> <a href="#" class="navbutton"><div style="padding-left: 2;">Text</div></a> </td> </tr> </table> <script type="text/javascript"> function expand(id) { document.getElementById("tableCollapsed" + id).style.display="none"; document.getElementById("tableExpanded" + id).style.display="block"; } function collapse(id) { document.getElementById("tableExpanded" + id).style.display="none"; document.getElementById("tableCollapsed" + id).style.display="block"; } </script> Any help would be nice. hi, i have a problem with my javascript---i have an image changer, and when you click on the name of the image it changes the image and the link to view the full size image. in firefox and chrome, this works fine, but in IE it displays only the URL for the image on click. the website is http://sc-lee.com/art.html , to view/test, and the code is: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="branch2.css" rel="stylesheet" type="text/css" /> <script> var thelink = 'http://sc-lee.com/art/2l.jpg'; </script> </head> <body> <div id="navss"><B>OTHER WORK</B> <a href="art.html">paintings & drawings</a> / <a href="collage.html">collage</a> / <a href="graphics.html">graphics</a> </div> <div id="back"><a href="javascript: history.go(-1)">< back</a></div> <div id="contenta"> <img src=art.gif /> <br> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/2.jpg'; var thelink = 'http://sc-lee.com/art/2l.jpg'">ONE</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/1.jpg'; var thelink = 'http://sc-lee.com/art/1l.jpg'">TWO</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/3.jpg'; var thelink = 'http://sc-lee.com/art/3l.jpg'">THREE</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/4.JPG'; var thelink = 'http://sc-lee.com/art/4l.jpg'">FOUR</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/5.jpg'; var thelink = 'http://sc-lee.com/art/5l.jpg'">FIVE</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/6.jpg'; var thelink = 'http://sc-lee.com/art/6l.jpg'">SIX</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/7.jpg'; var thelink = 'http://sc-lee.com/art/7l.jpg'">SEVEN</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/9.jpg'; var thelink = 'http://sc-lee.com/art/9l.jpg'">EIGHT</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/11.jpg'; var thelink = 'http://sc-lee.com/art/11l.JPG'">NINE</a> </div> <div id="contentb"> <img id="img1" name="mainimage" src="http://sc-lee.com/art/2.jpg"> <br /> <a href="#" onclick="javascript: window.open(thelink); "> + fullsize</a> </div> </body> </html> i'm afraid i just don't know enough about the differences between IE and firefox javascript compatability to fix this. please help! thanks, stephanie |