JavaScript - Getimage/drawimage Issues - .jpg Not Showing Up In Applet?
I'm very new to Java, and I'm actually working on an assignment at the moment, and typically I've been OK with troubleshooting but not so much right now.
I'm trying to draw an image onto an applet, however no matter what image I use, it doesn't show up when I run the applet. I'm using JGrasp for all of this, in case that's important. Thus far, my code is: public class ImageTest extends JApplet { public void paint (Graphics g) { super.paint(g); Image img=getImage(getCodeBase(), "CharlieDogPhoto.jpg"); g.drawImage(img, 0, 0, this); } } I compile and run the applet, but all I get is a gray blank screen. Is the code wrong, or is there some other way to load the image? Any help would be really awesome, sorry if this is incredibly simple... Thank you! Similar TutorialsHello, I'm new to javascript and html5. I've been having problems with some simple(?) lines of code. Code: var ctex; var totalX = 400; var totalY = 300; var racpad = new Image(); racpad.src = 'Imgs/paddle.gif'; var brixadow = new Image(); brixadow.src = 'Imgs/brickLight.gif'; function initCnv() { canvas = document.getElementById('canvas01'); ctex = canvas.getContext('2d'); AppStep(); } function clearcv(x) { ctex.clearRect(0, 0, totalX, totalY); ctex.fillStyle = x; ctex.beginPath(); ctex.rect(0, 0, totalX, totalY); ctex.closePath(); ctex.fill(); } function AppStep() { clearcv('black'); ctex.drawImage(racpad, totalX/2, totalY-50); } What I'm trying to do is to simply turn the canvas black and show a small gif on it. Upon executing initCnv(), the canvas turns black as it should, while the sprite image doesn't show up at all. I can't figure out what's going on, I scoured the code for syntax errors, even tried other image formats but to no avail. Image paths are also correct. Maybe the problem's an extremely noobish one, but I still couldn't get a clue, so I thought I'd ask for help around here. Thanks for your time! when i run applet nothing shows jsut text field [highlight=Java] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Assign6 extends JApplet implements ActionListener { JLabel answerLabel; JTextField answerField; public void init() { Container c = getContentPane(); c.setLayout (new FlowLayout()); answerLabel = new JLabel(""); answerField = new JTextField(10); answerField.setEditable(true); answerField.addActionListener(this); c.add(answerLabel); c.add(answerField); } public int generateNumbers() { int x=0; x = 1 + (int)(Math.random() * 10); return x; } public void actionPerformed(ActionEvent e) { String correct = new String("Correct "); int x = generateNumbers(); int y = generateNumbers(); showStatus("How much is " + x + " times " + y); int answer; answer = Integer.parseInt(answerField.getText()); int product = x*y; if (product == answer){ showStatus("Very good!"); } else showStatus("No. Please try again."); } @Override public void paint(Graphics g) { super.paint(g); } } { } [/highlight] Sorry if this post is very noobish, its because I am a noob. Ok, so I have a forum with Proboards and want to add a chat using the "headers/footers" but as Ive been having some trouble on my forum, I need the chat to have an admin panel (ban, warn, even see IP's if possible etc). I also need it to be streaming, not a refresh chat room. I cant seem to find a chat with this function anywhere, can anyone help? P.S I know you can have AddonChat with Proboards but that does not have the admin tools that I need and I cant afford to pay for these priveleges. If this is not possible, does anyone know any codes I could use with my AddonChat to at least give me some kind of admin control? Cheers xx Hello experts, My first question folks. I have recently joined a web based video conference which allow people to join as a guest (no need to create account). This conference's interface and function is written in javascript as an applet. To cut the long story short, is it possible to capture this applet and see the conference (without having to join the conference)? What happen at the moment is people wont be able to see the conference without join in and therefore take one slot out of 7 seats if you like. When all slots are taken people can not see the event. I was wondering if there is a way to capture this event using other javascript. I have all the scripts required to make this conference running, i know the logic of how javascript works but i dont know what is what in detail. Can anyone suggest anything? Thanks. I have now go an applet from http://castleamber.com/amberticker.html, I have contacted the publisher and asked whether ther is a way to add line/streaming text from a textarea into he applet at runtime, however they are not responding as yet. If possible could someone tell me how I would use a repaint() case statement in this applet in order to get the value of the textarea to reflect in the ticker. Any code I do use will have all compliments to the creators and those who have helped along the way. Thank you Hi, I'm making a page and I'd like to start an applet (Jmol) and display it near the button of the current page when a button is clicked. However, I get a syntax error: "missing ; before statement" (Note: this javascript is part of a cgi page) The code I have is as follow: Code: <script type="text/javascript" SRC="../jmol-12.0.48/Jmol.js"></script> <script type="text/javascript" language="Javascript"> function loadJmol(SMILES) { document.getElementById("viewMol").innerHTML = 'jmolInitialize("../jmol-12.0.48", true); jmolAppletInline(300, \'\', "load \$' + SMILES + '");' ; } </script> ... print "<a href=javascript:loadJmol(\"SomeString\")>View</a>"; print "<script id=\"viewMol\"></script>"; The syntax error occurs at the single quote in ...").innerHTML = 'jmolInitialize("... I have been able to get this applet to run when not in a function. Has anyone run into this before and can give me a hand? Thanks, Tom Internet Explorer requires the user to click on an applet to activate it, which means two clicks if there is a start button, for example. I previously learned a workaround, which is to activate the applet from an external Javascript, something like this: Code: document.write('<applet code="' + appletname + '" width="' + w + '" height="' + h + '"></applet>'); This doesn't work in IE8. Is there a workaround for IE8? Thanks. I have a Java Applet that I have been managing for some time. Approximately how long would it take to port a 900 line Java Applet to JavaScript? My intention is to reproduce as close as I can to the Java Applet. If you would like to see the Java Applet code, it is available here : http://www.chatapp.comuf.com/AppletClient(Public).java This Java Applet is a chat client that connects to a Java server (I am NOT porting the server). It has a simple interface with panel tabs for various activities (chat room, login, text color chooser, etc). **Note : I have not programmed in JavaScript before. I went over some tutorials before I posted this. ***N00b note : I know Java and JavaScript have NOTHING to do with each other. First of all, I must say that I am recently introduced to JavaScript and I am not fully aware of its complete functionality. So I have an HTML document which has defined within a its body a JavaScript function and I have also a JApplet class which is also loaded in the HTML and can call the JavaScript function. But I have also another Java class which is not an applet and I would like to find a way for this class to be able to call the JavaScript function (but it is essential for this class not to be an applet). I am aware that this would raise some security concerns but it is for local usage and I am interested to hear some ways if possible for this to be done. Thank You beforehand to all of you! I am trying to pass a screen resolution parameter to a java applet so that it will appear in full screen mode when it launches. This is working fine in Firefox and Chrome but not in IE8. Here is the code: 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> <script type="text/javascript"> function getresolution() { var yourres = screen.width + 'x' + screen.height; document.write('<param name="geometry" value="' + yourres + '">'); } </script> </head> <body> <applet name='rdp' code='com.elusiva.rdp.applet.RdpApplet' archive='JavaRDP16-1.1.jar' codebase='.' width='1' height='1'> <param name='server' value='XXXXXXXXXX'> <param name='port' value='3389'> <param name='shell' value='C:\seamlessrdp\seamlessrdpshell.exe -s C:\Program%20Files%20(x86)\TRAMS\CBplus\CBplus.exe'> <script type="text/javascript">getresolution();</script> </applet> </body> </html> Any help on this would be much appreciated! EDIT: Posted in the wrong forum. Here's my code: Code: // Lab09GRFX04st.java // This is the student, starting file for the Lab09GRFX04st assignment. // The Lab09 practice and graded assignment is open ended. // No code will be provided in the student, starting file. // There are also no files with solutions for the different point versions. // Check the Lab assignment document for additional details. import java.awt.*; import java.applet.*; public class Lab09GRFX04st extends Applet { public void paint(Graphics g) { Meal order1 = new Meal(g,0,0); } } class Tray { public Tray(Graphics g, int x, int y) { g.setColor(Color.lightGray); g.fillRect(x+10,y+100,400,200); g.setColor(Color.black); g.drawRect(x+25,y+115,370,170); } } class Utensil { public Utensil(Graphics g, int x, int y) { g.setColor(Color.gray); g.fillRect(x+60,y+200,10,60); } } class Fork extends Utensil { private int x; private int y; public Fork(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawFork(g); } public void drawFork(Graphics g) { g.setColor(Color.gray); g.fillRect(x+50,y+185,30,15); Polygon prong1 = new Polygon(); prong1.addPoint(x+50,y+185); prong1.addPoint(x+56,y+185); prong1.addPoint(x+53,y+165); g.fillPolygon(prong1); Polygon prong2 = new Polygon(); prong2.addPoint(x+61,y+185); prong2.addPoint(x+67,y+185); prong2.addPoint(x+64,y+165); g.fillPolygon(prong2); Polygon prong3 = new Polygon(); prong3.addPoint(x+74,y+185); prong3.addPoint(x+80,y+185); prong3.addPoint(x+77,y+165); g.fillPolygon(prong3); } } class Spoon extends Utensil { private int x; private int y; public Spoon(Graphics g,int x1,int y1) { super(g,x1,y1); x = x1; y = y1; drawSpoon(g); } public void drawSpoon(Graphics g) { g.setColor(Color.gray); g.fillOval(x+50,y+175,30,40); } } class Knife extends Utensil { private int x; private int y; public Knife(Graphics g, int x1,int y1) { super(g,x1,y1); x = x1; y = y1; drawKnife(g); } public void drawKnife(Graphics g) { g.setColor(Color.gray); g.fillArc(x+55,y+165,30,60,90,180); } } class Napkin { public Napkin (Graphics g, int x, int y) { g.setColor(Color.white); g.fillRect(x+50,y+170,60,100); g.setColor(Color.darkGray); g.drawLine(x+95,y+170,x+95,y+270); } } class MainDish { private int x; private int y; public MainDish(Graphics g, int x1, int y1) { x = x1; y = y1; g.setColor(Color.white); g.fillOval(x+155,y+215,150,50); g.setColor(Color.cyan); g.drawArc(x+175,y+225,110,30,170,210); } } class Burger extends MainDish { private int x; private int y; public Burger(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawBun(g); drawBurger(g); } public void drawBun(Graphics g) { g.setColor(Color.orange); g.fillArc(x+180,y+180,100,70,0,180); g.fillRect(x+182,y+230,96,15); } public void drawBurger(Graphics g) { Color brown = new Color(150,75,0); g.setColor(brown); g.fillRect(x+185,y+215,90,15); } } class Cheeseburger extends Burger { private int x; private int y; public Cheeseburger(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawCheese(g); } public void drawCheese(Graphics g) { g.setColor(Color.yellow); Polygon cheese = new Polygon(); cheese.addPoint(x+195,y+215); cheese.addPoint(x+265,y+215); cheese.addPoint(x+230,y+225); g.fillPolygon(cheese); } } class Hamburger extends Burger { private int x; private int y; public Hamburger(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawSesameSeeds(g); drawLettuce(g); } public void drawSesameSeeds(Graphics g) { g.setColor(Color.yellow); g.fillOval(x+190,y+200,3,3); g.fillOval(x+200,y+190,3,3); g.fillOval(x+210,y+197,3,3); g.fillOval(x+220,y+207,3,3); g.fillOval(x+260,y+193,3,3); g.fillOval(x+230,y+185,3,3); g.fillOval(x+240,y+195,3,3); g.fillOval(x+253,y+200,3,3); g.fillOval(x+267,y+202,3,3); g.fillOval(x+220,y+193,3,3); } public void drawLettuce(Graphics g) { g.setColor(Color.green); Polygon lettuce = new Polygon(); lettuce.addPoint(x+185,y+215); lettuce.addPoint(x+275,y+215); lettuce.addPoint(x+285,y+225); lettuce.addPoint(x+275,y+220); lettuce.addPoint(x+265,y+225); lettuce.addPoint(x+255,y+220); lettuce.addPoint(x+245,y+225); lettuce.addPoint(x+235,y+220); lettuce.addPoint(x+225,y+225); lettuce.addPoint(x+215,y+220); lettuce.addPoint(x+205,y+225); lettuce.addPoint(x+195,y+220); lettuce.addPoint(x+185,y+225); lettuce.addPoint(x+175,y+220); g.fillPolygon(lettuce); } } class Drink { private int x; private int y; private Color drinkColor; public Drink(Graphics g, Color c1, int x1, int y1) { x = x1; y = y1; drinkColor = c1; drawCup(g); } public void drawCup(Graphics g) { Polygon cup = new Polygon(); cup.addPoint(x+305,y+190); cup.addPoint(x+365,y+190); cup.addPoint(x+370,y+80); cup.addPoint(x+300,y+80); g.setColor(drinkColor); g.fillPolygon(cup); } } class Soda extends Drink { private int x; private int y; private Color drinkColor; public Soda(Graphics g, Color c1, int x1, int y1) { super(g,c1,x1,y1); x = x1; y = y1; drinkColor = c1; drawTop(g); } public void drawTop(Graphics g) { g.setColor(Color.red); g.fillRect(x+335,y+25,7,45); g.fillRect(x+335,y+25,30,7); g.setColor(Color.white); g.fillRect(x+295,y+70,80,10); g.setColor(Color.black); g.drawRect(x+295,y+70,80,10); } } class CocaCola extends Soda { private int x; private int y; public CocaCola(Graphics g, int x1, int y1) { super(g,Color.red,x1,y1); x = x1; y = y1; drawCupDesign(g); } public void drawCupDesign(Graphics g) { g.setColor(Color.white); g.drawString("C",x+310,y+100); g.drawString("O",x+310,y+110); g.drawString("C",x+310,y+120); g.drawString("A",x+310,y+130); g.drawString(" ",x+310,y+140); g.drawString("C",x+310,y+150); g.drawString("O",x+310,y+160); g.drawString("L",x+310,y+170); g.drawString("A",x+310,y+180); g.drawOval(x+325,y+85,5,5); g.drawOval(x+335,y+100,3,3); g.fillArc(x+340,y+36,30,90,180,180); g.fillArc(x+340,y+125,27,130,0,180); g.setColor(Color.lightGray); g.drawArc(x+340,y+36,30,90,270,90); g.drawArc(x+340,y+125,27,130,95,85); g.drawArc(x+340,y+36,29,90,270,90); g.setColor(Color.red); g.fillArc(x+340,y+36,20,90,180,180); g.fillArc(x+350,y+125,17,130,0,180); } } class Sprite extends Soda { private int x; private int y; public Sprite(Graphics g, int x1, int y1) { super(g,Color.cyan,x1,y1); x = x1; y = y1; drawCupColor(g); drawCupDesign(g); } public void drawCupColor(Graphics g) { for (int blue = 170; blue <= 210; blue++) { g.setColor(new Color(0,100,blue)); g.drawLine(blue+260,81,blue+255,189); } for (int gr = 160; gr <= 200; gr++) { g.setColor(new Color(0,gr,0)); g.drawLine(gr+240,81,gr+245,189); } } public void drawCupDesign(Graphics g) { g.setColor(Color.green); g.fillArc(x+340,y+157,20,15,5,170); g.fillArc(x+340,y+155,20,15,-5,-170); g.setColor(Color.yellow); g.fillArc(x+336,y+150,20,15,5,170); g.fillArc(x+336,y+148,20,15,-5,-170); g.setColor(Color.white); g.drawString("S",x+315,y+160); g.drawString("p",x+322,y+150); g.drawString("r",x+329,y+140); g.drawString("i",x+336,y+130); g.drawString("t",x+343,y+120); g.drawString("e",x+350,y+110); } } class HotDog extends MainDish { private int x; private int y; public HotDog(Graphics g, int x1,int y1) { super(g,x1,y1); x = x1; y = y1; drawHotDog(g); } public void drawHotDog(Graphics g) { g.setColor(Color.orange); g.fillRect(x+180,y+220,20,20); g.fillRect(x+200,y+220,60,20); g.fillRect(x+260,y+220,20,20); g.fillArc(x+170,y+220,20,20,90,180); g.fillArc(x+270,y+220,20,20,270,180); g.fillArc(x+180,y+235,100,10,180,180); g.fillRect(x+180,y+230,20,20); g.fillRect(x+200,y+230,60,20); g.fillRect(x+260,y+230,20,20); g.fillArc(x+170,y+230,20,20,90,180); g.fillArc(x+270,y+230,20,20,270,180); g.fillArc(x+180,y+245,100,10,180,180); g.setColor(Color.red); g.fillArc(x+180,y+224,100,12,180,180); g.setColor(Color.white); g.fillArc(x+187,y+214,86,10,180,180); } } class Powerade extends Soda { private int x; private int y; public Powerade(Graphics g, int x1, int y1) { super(g,Color.blue,x1,y1); g.setColor(Color.black); g.drawString("POWERADE",x+301,y+120); g.setColor(Color.white); g.drawString("POWERADE",x+302,y+121); } } class Meal { private Utensil utensil; private Tray tray; private Fork fork; private Spoon spoon; private Knife knife; private Napkin napkin; private Hamburger plainBurger; private Cheeseburger wCheese; private Powerade bigK; private Sprite coke; private HotDog dog; public Meal(Graphics g, int x, int y) { tray = new Tray(g,x,y); napkin = new Napkin(g,x,y); fork = new Fork(g,x+20,y); spoon = new Spoon(g,x,y); knife = new Knife(g,x+50,y); dog = new HotDog(g,x,y); bigK = new Powerade(g,x,y); coke = new Sprite(g,x+100,y); } } It compiles; however, once I switch to the HTML window and try to run it, a screen appears and the status bar is giving me the "Start: applet not initialized error." Here's my HTML code: Code: <APPLET CODE = "Lab09GRFX04st.class" WIDTH=1000 HEIGHT=650> </APPLET> Does anyone know what's wrong? Hi, I have the following codes but my checkbox is not appearing. The values of the checkbox do print out in the alert. Can anyone tell me what is wrong with it? Thank you! Code: var table = document.getElementById('maintable'); var i; // iterator var item; // pointer to item in received list for(i = 0; (item = contacts.ReturnValue.getNext()) != undefined; ++i) { table.insertRow(i + 1); var result = "<td>"; if(item.FirstName != undefined) { result += item.FirstName.Value; } result += "</td><td>"; if(item.LastName != undefined) { result += item.LastName.Value; } result += "</td><td>"; if(item.MobilePhoneGen != undefined) { result += item.MobilePhoneGen.Value; } result += "</td><td>"; if(item.EmailGen != undefined) { result += item.EmailGen.Value; } var td1 = document.createElement("td"); var chkbox = document.createElement('input'); chkbox.type='Checkbox'; table.rows[i + 1].innerHTML = result; chkbox.value=item.MobilePhoneGen.Value; td1.appendChild(chkbox); alert(chkbox.value); } thanks this problem has been solved
i am having some problem showing and hiding some div i want to show the div with the id="universitiesDiv" on one point and the div id="highSchoolsDiv" on another depending on the user choice of selected option. Code: function Show (titleImg){ // the id of the content element from the id of the title element var contentID = titleImg.id.replace (/title/, "content"); var contentDiv = document.getElementById (contentID); contentDiv.style.display = "block"; return false; } function Hide (titleImg){ // the id of the content element from the id of the title element var contentID = titleImg.id.replace (/title/, "content"); var contentDiv = document.getElementById (contentID); contentDiv.style.display = "none"; return false; } the functions work fine i have tested them on input type="checkbox" and they work fine Code: <select name="education" id="education" onfocus="Show(this.options[this.selectedIndex].value);"> <option selected value="00">-الرجاء الاختيار-</option> <option value="highSchoolsDiv">مدرسة ثانوية</option> <option value="universitiesDiv"> كلية </option> <option value="universitiesDiv">درجة البكالوريوس</option> <option value="universitiesDiv">درجة عليا</option> <option value="universitiesDiv">دكتوراه / ما بعد الدكتوراه</option> <option value="07">اسألني فيما بعد</option> </select> </span> </div> </td></tr></table> </div> <div> <div class="Left"></div> <table class="step2" ><tr><td> <div class="Right"> <div class="Inner" id="Inner"> <div id="universitiesDiv" class="Row innerError" style="display:none;"> <div class="Left"> <label for="universities">الجامعة / الكلية</label></div> <div class="Right"> <input type="text" name="universities" id="universities" class="text" autocomplete="off" onfocus="focusInput(this);" onchange=" validate_JoinPersonalInfoForm_universities();" onblur="blurInput(this); validate_JoinPersonalInfoForm_universities();" size="55"/> </div> </td></tr><tr><td> </div> <div id="highSchoolsDiv" class="Row innerError" style="display:none;"> <div class="Left"> <label for="high_schools">المدرسة الثانوية</label></div> <div class="Right"> <input type="text" name="high_schools" id="high_schools" class="text" autocomplete="off" onfocus="focusInput(this);" onchange=" validate_JoinPersonalInfoForm_high_schools();" onblur="blurInput(this); validate_JoinPersonalInfoForm_high_schools();" size="55"/> </div> </div> </div> </div> </td></tr></table> </div> here is doesn't do nothing i have tried onblur onfocus onchange onselect everything i even tried then in side the option <option onselect... !!!!! anyone can help me, that would be great thanks i've been having some trouble with showing images and i think it's a problem with the image source, i would like to know how i must alter my code to fix this thnx. i should also point out that the images are the 6 sides of a dice Code: <html> <head> <title>My Script</title> <script type = "text/javascript"> if (document.images) { image1 = new Image(10,10); image1.source = "d1.gif"; image2 = new Image(10,10); image2.source = "d2.gif"; image3 = new Image(10,10); image3.source = "d3.gif"; image4 = new Image(10,10); image4.source = "d4.gif"; image5 = new Image(10,10); image5.source = "d5.gif"; image6 = new Image(10,10); image6.source = "d6.gif"; } alert(image1); alert(image2); alert(image3); alert(image4); alert(image5); alert(image6); </script> </head> <body> </body> </html> The alert at the top of this function will not show... Code: function getXmlHttpRequestObject() { alert("HTTP XML REQUEST!"); var httpxml; if (window.XMLHttpRequest) { // code decent browsers like Firefox, Chrome, Opera, Safari. And IE7+... httpxml = new XMLHttpRequest(); return httpxml; } else { if (window.ActiveXObject) { //Code for crap like IE httpxml = new ActiveXObject('Microsoft.XMLHTTP'); return httpxml; } else { httpxml = null; } } if (httpxml == null) { document.getElementById('p_status').innerHTML = "Status: Could not create XmlHttpRequest Object, please upgrade your browser!"; return null; } else { return httpxml; } I am supposed to create a calendar and have the calendar show up in the top right of the screen while also highlighting the current date set on it. Nothing shows up... HTM: Code: <?xml version="1.0" encoding="UTF-8" ?> <!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"> <!-- New Perspectives on JavaScript, 2nd Edition Tutorial 3 Tutorial Case The Chamberlain Civic Center Author: Date: Filename: ccc.htm Supporting files: back.jpg, calendar.css, calendar.js, ccc.css, ccc.jpg, logo.gif --> <title>The Chamberlain Civic Center</title> <link href="ccc.css" rel="stylesheet" type="text/css" /> <link href="calendar.css" rel="stylesheet" type="text/css" /> <script src="calendar.js" type="text/javascript"></script> </head> <body> <div id="head"> <script type="text/javascript"> calendar("March 25, 2011"); </script> <img src="ccc.jpg" alt="Chamberlain Civic Center" /> </div> <div id="links"> <table><tr> <td><a href="#">Home</a></td><td><a href="#">Tickets</a></td> <td><a href="#">Events</a></td><td><a href="#">Tour</a></td> <td><a href="#">Directions</a></td><td><a href="#">Hours</a></td> <td><a href="#">Packages</a></td><td><a href="#">Contact Us</a></td> </tr></table> </div> <div id="main"> <p id="firstp"><img src="photo.jpg" alt="" />March is another banner month at the Chamberlain Civic Center, with performances of the award-winning musical, <span>The Producers</span> by the Broadway Touring Company on March 4, 5, and 6. Tickets are going fast, so order yours today.</p> <p>Celebrate the season on March 11 with the Chamberlain Symphony and their special selection of classical music with Spring themes. The next day, March 12, exercise your mind by attending the Charles Dickens mystery <span>Edwin Drood</span>.</p> <p>Jazz lovers have a lot to celebrate in March with a visit from <span>The Jazz Masters</span> on the 17th. Then on March 24, enjoy the music of The Duke with <span>An Ellington Tribute</span> performed by the Jazz Company of Kansas City.</p> <p>Pins, bottles, plates, and chairs are flying at the Chamberlain Civic Center in March. <span>The Taiwan Acrobats</span> return with another amazing performance on Sunday, March 13. On March 20, the <span>Madtown Jugglers</span> get into the act with their unique blend of comedy, juggling, and madness.</p> <p>Enjoy a classical brunch every Sunday afternoon with music provided by the Carson Quartet. Seating is limited, so please reserve your table.</p> </div> <address> The Chamberlain Civic Center · 2011 Canyon Drive · Chamberlain, SD 57325 · (800) 555-8741 </address> </body> </html> Java Code: /* New Perspectives on JavaScript, 2nd Edition Tutorial 3 Tutorial Case Author: Date: Function List: calendar(calendarDay) Creates the calendar table for the month specified in the calendarDay parameter. The current date is highlighted in the table. writeCalTitle(calendarDay) Writes the title row in the calendar table writeDayTitle() Writes the weekday title rows in the calendar table daysInMonth(calendarDay) Returns the number of days in the month from calendarDay writeCalDays(calendarDay) Writes the daily rows in the calendar table, highlighting calendarDay */ function calendar(calendarDay) { if (calendarDay == null) calDate=new Date() else calDate = new Date(calendarDay); document.write("<table id='calendar_table'>"); writeCalTitle(calDate); writeDayNames(); writeCalDays(calDate); document.write("</table>"); } function writeCalTitle(calendarDay) { var monthName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "Octoboer", "November", "December"); var thisMonth=calendarDay.getMonth(); var thisYear=calendarDay.getFullYear(); document.write("<tr>"); document.write("<th id='calendar_head' colspan='7'>"); document.write(monthName[thisMonth]+" "+thisYear); document.write("</th>"); document.write("</tr>"); } function writeDayNames() { var dayName = new Array ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); document.write("<tr>"); for (var i=0; i < dayName.length; i++) { document.write("<th class='calendar_weekdays'> "+dayName[i]+"</th>"); } document.write("</tr>"); } function daysInMonth(calendarDay) { var thisYear = calendarDay.getFullYear(); var thisMonth = calendarDay.getMonth(); var dayCount = new Array (31,28,31,30,31,30,31,31,30,31,30,31); if (thisYear % 4 == 0) { if ((thisYear % 100 != 0) || (thisYear % 400 == 0)) { dayCount[1] = 29; } } return dayCount[thisMonth]; } function writeCalDays(calendarDay) { var currentDay = calendarDay.getDate(); var dayCount = 1; var totalDays = daysInMonth(calendarDay); calendarDay.setDate(1); var weekDay = calendarDay.getDay(); document.write("<tr>"); for (var i=0; i < weekDay; i++) { document.write("<td></td>"); } while (dayCount <= totalDays) { if (weekDay == 0) document.write("<tr>"); if (dayCount == currentDay) { document.write("<td class='calendar_dates' id='calendar_today'>"+dayCount+"</td>"); } else { document.write("<td class='calendar_dates'>"+dayCount+"</td>"); } if (weekDay == 6) document.write("</tr>"); dayCount++; calendarDay.setDate(dayCount); weekDay = calendarDay.getDay(); } document.write("</tr>"); } CSS (calendar) Code: /* New Perspectives on JavaScript, 2nd Edition Tutorial 3 Tutorial Case Filename: calendar.css This file contains styles applied to the calendar table */ #calendar_table {float: right; background-color: white; font-size: 9pt; font-family: Arial, Helvetica, sans-serif; border-style: outset; border-width: 5px; margin: 0px 0px 5px 5px} #calendar_head {background-color: rgb(223,29,29); color: ivory; letter-spacing: 2px} .calendar_weekdays {width: 30px; font-size: 10pt; border-bottom-style: solid} .calendar_dates {text-align: center; background-color: white} #calendar_today {font-weight: bold; color: rgb(223,29,29); background-color: ivory; border: 1px solid black} CSS (page) Code: /* New Perspectives on JavaScript, 2nd Edition Tutorial 3 Tutorial Case Filename: ccc.css This file contains styles used in the ccc.htm file */ body {margin: 0px; background: white url(back.jpg) repeat-y scroll 820px 0px} #head {width: 750px; height: 150px; padding: 5px} #links {clear: right; width: 750px; padding: 0px} #links table {width: 750px; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; margin: 0px} #links table td {text-align: center; background-color: white; border: 1px solid black; letter-spacing: 5; padding: 2px} #links table a {text-decoration: none; color: rgb(223,29,29); width: 100%} #links table a:hover {color: white; background-color: rgb(223,29,29)} #main {width: 750px; font-family: Arial, Helvetica, sans-serif; padding: 10px} #main p {text-align: justify; font-size: 9pt} #firstp:first-line {font-variant: small-caps} #main img {float: right; margin: 0px 0px 10px 10px} #main p span {color: rgb(223,29,29)} address {width: 750px; font-size: 8pt; font-style: normal; color: rgb(223,29,29); font-family: Arial, Helvetica, sans-serif; text-align: center; border-top: 1px solid rgb(223,29,29); padding-bottom: 10px} Can anyone see something wrong? This is really frustrating me as I'm not very good with javascript but thought I did this one right... I have 1 html page and 1 flash object on it when i click on that flash object than a image should b appear and flash object will hide when i click on that image than flash object should b appear and image will hide the page should b same no other pages can i do this using javascript? if yes than please send the code Hey everyone Okay so... I'm working on a site, which will include a registration form for users that wish to register. In this registration form I would like it to have an AJAX based effect, such that when the user types each letter out for his username in the field, his username will appear (letter upon letter) itself below, at the end of their unique url. To explain further:- Say I type my username to be Owen Below the field I would like it to display: http://www.mydomain.com/Owen http://Owen.mydomain.com/ As I type it. Is this possible? I've done my research, but had little luck. I'm sure it is possible as I've seen it before in a slightly different manner. Hope you can or are willing to help Thank you Owen Ayres hi, on my website: http://zend.warrencreative.com/gemini-group/index.html the carousel on the right is not showing unless you hover your mouse over?! Can some one please help? I am using : http://www.twospy.com/galleriffic/ |