JavaScript - I Get Interface Accepted After Public Token?
public classTestGeometricObject{
/** Main Method */ public static void main(String[] args) { //Declare and initialize two geometric objects GeometricObject geoObject1 = new Circle(5); GeometricObject geoObject2 = new Rectangles(5,3); System.out.println("The two objects have the same area? " + equalArea(geoObject1, geoObject2)); //Display circle displayGeometricObject(geoObject1); //Display rectangle displayGeometricObject(geoObject2); } /**A method for comparing */ public static boolean equalArea(GeometricObject object1, GeometricObject object2) { return object1.getArea()==object2.getArea(); } /**A method for displaying a geometric object*/ public static void displayGeometricObject(GeometricObject object){ System.out.println(); System.out.println("The area is " + object.getArea()); System.out.println("The perimeter is " + object.geetPerimeter()); } } Similar Tutorialspublic classTestGeometricObject{ /** Main Method */ public static void main(String[] args) { //Declare and initialize two geometric objects GeometricObject geoObject1 = new Circle(5); GeometricObject geoObject2 = new Rectangles(5,3); System.out.println("The two objects have the same area? " + equalArea(geoObject1, geoObject2)); //Display circle displayGeometricObject(geoObject1); //Display rectangle displayGeometricObject(geoObject2); } /**A method for comparing */ public static boolean equalArea(GeometricObject object1, GeometricObject object2) { return object1.getArea()==object2.getArea(); } /**A method for displaying a geometric object*/ public static void displayGeometricObject(GeometricObject object){ System.out.println(); System.out.println("The area is " + object.getArea()); System.out.println("The perimeter is " + object.getPerimeter()); } } Hey guys, i have a question about my array. I have an array called numberarray with 20 elements and i want it to be accepted into a function as a parameter? But i only want the first 10 to be accepted. Does anyone know exactly how i would go about doing this in my function?
Hi i have set up a token key to give me some extra protection against direct url access to the page but i wanted to make it random. at first i used session token but it is not set until after a page refresh on login so this has to be its own deal.. i have found several javascript random codes but how to i pass that value to the window call.. here is the window call.. as you can see right know i have it hard coded as one token all the time. i just need it random and then sha1 (or md5) Code: function url_chat(){ chatwindow = window.open("<?=$CONST_MY_ROOT?>/mychat/chat/index.php?tok=0ed61bdd3a8a86f39e6b4abd01ba4e3649d0ec1c", "chatwindow", "location=0,status=0,scrollbars=0,menubar=0,resizable=0,width=950,height=550"); } i could use this i guess but i dont know how to get that value to the window call above. Code: document.write(Math.floor(Math.random()*999999999999999999)); Hello, I do not have a lot of experience with Java and my HTML skills have not been put to use in a few years. The problem that I am having is trying to call a .js from an IIS footer file. The script is Code: <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://216.128.27.18/" : "http://216.128.27.18/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 25); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script><noscript><p><img src="http://216.128.27.18/piwik.php?idsite=25" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> When added directly to the <body></body> of the html it works but i want to append it to all pages with a footer. I created an piwik.js with that above code then made an html file with Code: <script src="piwikfooter.js" type="text/javascript"></script> It does try to call the script but I get an error when loading the site piwikfooter.js:2Uncaught SyntaxError: Unexpected token< Any help would be very much appreciated. Would I use php or javascript to make an admin interface so someone can update the web page i made for them easilier? As of now, they need to change the html page and upload an image using filezilla. Are there any Admin interfaces that allow you to customize what you want to change/add to an html page? Hello i'm using TinyceEditor in my website and i'm using AjaxFileManager to upload images. It works very good in my localhost, but in the remote server while uploading image an error appears (" Syntaxerror: unexpected token < ") and uploading stop. please i need the answer quickly Hi This is what I would like to do: 1. Create a tabbed interface 2. All tabs but one must be able to be closed by clicking a link 3. User must be able to add additional tabs I want this to be done in Javascript but I have no clue how to program in javascipt and tutorials I have seen do not go in to great detail since they just show you basics that a Kindergarten kid could use. Please help Thanks A webapp i'm working on needs to be able to use UTF8 characters, and be able to write them to a disk (using XP Universal Connect) - just like my previous webapps. However, when i write normal text to the output file, i get no problems. When i try to write a Chinese character (e.g. 你) to the output file, i just get a comma " ' " character written in it's place. here is the function that is writing the data to the disk: Code: function SaveToDisk(FileName, Content) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("Permission to save file was denied."); } var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath( FileName ); if ( file.exists() == false ) { file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420 ); } var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance( Components.interfaces.nsIFileOutputStream ); outputStream.init( file, 0x04 | 0x08 | 0x20, 420, 0 ); var output = Content; var result = outputStream.write( output, output.length ); outputStream.close(); } I checked my browser, and it's already in UTF8 mode when i am writing this file. I'm curious as to what is not working. Is there some special value that i need to change in my SaveToDisk() function? I'm making a javascript POST that returns some information in this format. It's copied from the web API website I'm developing from. Returns a token on success. Code: { "errors": [ ], "warnings": [ ], "data": { "token": "ta98585435afabcf26319e2038a09f40" }, "page": { "current": 1, "total": 1 } } How can I get the data.token bit out specifically? hey guys, i've just started programming in javascript, and now i am studying how to use OOP in javascript. i've read most of the tutorials but none of them has mentioned anything about the public, private and protected stuff. so i guess my question is - does oo in javascript deal with public,private and protected methods or variables? thanks in adv. Hi Everybody- I have searched thru and have not been able to find info on this here. I am looking for help with a countdown that uses information from a public google calendar. The calendar has recurring dates of church services - Sundays at 10 am (recurring). The countdown code that I have run into so far does not support this. If this could use the google calendar information, that would be great thanks for your help and any tips best wishes Hi there, we have quite a big and successful project going on. We're a bunch of hardcore hockey gaming people and we're editing a game that has its entire interface written in Javascript. The whole game has been completely rebuilt... graphics, sounds, etc. Also all menus have been changed and reconstructed and we have managed to add some really unique features (previously unseen in sports games). I have some really wild ideas for the interface but we're at a dead end because we don't really have anyone who has advanced JS skills. See our project here. You can see the completely rebuilt menu features in the thumbnails. If this forum has someone who's interested in hockey simulator & gaming and has JS skills and would like to develop this brilliant game with us, I would like to get in touch with him. I can send him the full (unmodified base game) any time. The modifications have to be installed from the thread I linked. Thanks in advance. Best regards Trent From:tibettravel.org According to source from Lhasa's transportation management office, local vehicles in public transportation, farming and forestry sectors will enjoy a direct financial subsidy from the municipal government of Lhasa, capital city of southwest China's Tibet Autonomous Region. Urban cabs will get 110 yuan and urban buses will get 100 yuan per month for each while buses of rural routes will ge 120 yuan per month for each. Transportation service companies should collect the monthly operation information of all vehicles and then report to the municipal transportation management office. Subsidies will be delivered directly to the companies and then transferred to vehicle owners or drivers after financial verification. Sources from: China Tibet Online;Reported by:tibettravel.org Hi there, I'm trying really hard to find the solution to this error I am getting in java. Im using blue j. I have a feeling its something other than just braces missing somewhere, I have looked carefully and I'm just having bad luck!! I cant proceed to the next stage of my code unless I get this bit perfected with no syntax errors. I really really appreciate someone helping me out. Code: import java.util.Scanner; import java.awt.Color; /** * Write a description of class stage2 here. * * @author (Gayethiri Guruthevan) * @version (Version 1.0) */ public class stage2 { public static void main(String[]args) { final int WIDTH = 500; // width of the sheet in pixels final int HEIGHT = 500; // height of the sheet in pixels int x; // the x-coordinate int y; // the y-coordinate String direction; // the direction chosen // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // 1. Ask the user for the ant's x-coordinate System.out.print("Enter your ant's x-coordinate: "); x = keyboard.nextInt(); // 2. If the x-coordinate is outside the allowed range, // print an error message and exit if(x < 0 || x > WIDTH-1) { System.out.println("The x-coordinate must be between 0 and " + (WIDTH-1)); System.exit(-1); } // 3. Ask the user for the ant's y-coordinate System.out.print("Enter your ant's y-coordinate: "); y = keyboard.nextInt(); // 4. If the integer is outside the allowed range, // print an error message and exit if(y < 0 || y > HEIGHT-1) { System.out.println("The Y-coordinate must be between 0 and " + (HEIGHT-1)); System.exit(-1); } // 5. Ask the user for the direction System.out.print("Enter the direction the ant is facing: "); direction = keyboard.next(); System.out.print("How many steps should the ant take?: "); int numStepsToTake = keyboard.nextInt(); for(int i=0; i<numStepsToTake;i++) { if (direction.equalsIgnoreCase("DL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("DR")) { y-=1; x+=1; } else if (direction.equalsIgnoreCase("D")) { y-=1; } if (direction.equalsIgnoreCase("U")) { x+=1; } else if (direction.equalsIgnoreCase("UR")) { y+=1; x+=1; } else if (direction.equalsIgnoreCase("UL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("L")) { x-=1; } else if(direction.equalsIgnoreCase("R")) { x+=1; } else { System.out.println("That is incorrect please enter the right direction"); } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(x < 0) { x += WIDTH; } else if(x > WIDTH-1) { x-=WIDTH; } if(y < 0) { y += HEIGHT; } else if(y > HEIGHT-1) { y-=HEIGHT; } //Here is the new method for antart. AntArt.init(WIDTH,HEIGHT,x,y); for(int i=0; i<numStepsToTake;i++) { int oldX = x; int oldY = y; Color paperColor = AntArt.getColor(x,y); antColor = nextColor(antColor,paperColor); AntArt.setColor(antColor); // Take a step direction = nextDirection(direction,antColor,paperColor); x = stepX(x,direction,WIDTH,HEIGHT); y = stepY(y,direction,WIDTH,HEIGHT); AntArt.paint(oldX,oldY); } AntArt.paint(x,y); System.out.println("The new x is " + x + " and y coordinate is " + y); } } } private static int stepx(int x, String direction, int WIDTH, int HEIGHT) { //this will be the answer int newx = x; // take a step in the right direction if(direction.equals("UR")) { newx += 1; } else if (direction.equals("R")) { newx += 1; } else if(direction.equals("DR")) { newx += 1; } else if(direction.equals("DL")) { newx -= 1; } else if(direction.equals("L")) { newx -= 1; } else if(direction.equals("UL")) { newx -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newx < 0) { newx += WIDTH; } else if(newx > WIDTH-1) { newx -= WIDTH; } return newx; } } } private static int stepY(int y, String direction, int WIDTH, int HEIGHT) { // this will be the answer int newy = y; // take a step in the right direction if(direction.equals("UR")) { newy += 1; } else if (direction.equals("R")) { newy += 1; } else if(direction.equals("DR")) { newy += 1; } else if(direction.equals("DL")) { newy -= 1; } else if(direction.equals("L")) { newy -= 1; } else if(direction.equals("UL")) { newy -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newy < 0) { newy += HEIGHT; } else if(newy > HEIGHT-1) { newy -= HEIGHT; } return newy; } } Hello, this is my first post. The following code works in FF, Is there any way to have the code work correctly in IE 7? The error is on both the following lines, odoc.appendChild(ne);. Thank you for any assistance. Quote: <!--#include file="include/dbcommon.asp"--> <% set dbConnection = server.CreateObject ("ADODB.Connection") dbConnection.ConnectionString = strConnection dbConnection.Open %> <html> <head> <link REL="stylesheet" href="include/style.css" type="text/css"> <!--[if IE]> <link REL="stylesheet" href="include/styleIE.css" type="text/css"> <![endif]--> </head> <body> <table> <tr><td> Subject:</td> <td><input id=subject type=text size=40></td> <td align=right> Templates: <select id=templates style="width:300" onchange="doInsert(document.getElementById('templates').value);document.getElementById('templates'). selectedIndex=0;"> <option value="">Please select</option> <% Set rs = server.CreateObject ("ADODB.Recordset") rs.Open "select * from QuickTemplates", dbConnection,1,2 while not rs.eof fname=replace(rs("fname"),"""",""") if(len(rs("fname"))>40) then _ fname=replace(left(rs("fname"),30)&"...","""",""") response.write "<option value=""" & replace(rs("fname"),"""",""") & """>" & fname & "</option>" rs.movenext wend rs.close %> </select> </td></tr> <tr> <td valign=top>Body:</td><td colspan=2><textarea id=body cols=100 rows=20></textarea></td> </tr> <td align=center colspan=3> <SPAN class=buttonborder><input class=button type=button value="Send email" onclick="sendem();"></SPAN> <SPAN class=buttonborder><input class=button type=button value="Close" onclick="self.close();return false;"></SPAN> </td> </tr> </table> </body> <html> <script> function sendem() { odoc=opener.document.getElementById("frmAdmin"); opener.document.forms.frmAdmin.a.value="email"; ne=document.createElement("input"); ne.name="subject"; ne.type="hidden"; ne.value=document.getElementById("subject").value; odoc.appendChild(ne); ne=document.createElement("input"); ne.name="body"; ne.type="hidden"; ne.value=document.getElementById("body").value; odoc.appendChild(ne); opener.document.forms.frmAdmin.submit(); self.close(); } function doInsert(ibTag) { var uagent = navigator.userAgent.toLowerCase(); var is_safari = ( (uagent.indexOf('safari') != -1) || (navigator.vendor == "Apple Computer, Inc.") ); var is_opera = (uagent.indexOf('opera') != -1); var is_webtv = (uagent.indexOf('webtv') != -1); var ua_vers = parseInt(navigator.appVersion); var is_win = ( (uagent.indexOf("win") != -1) || (uagent.indexOf("16bit") !=- 1) ); var is_ie = ( (uagent.indexOf('msie') != -1) && (!is_opera) && (!is_safari) && (!is_webtv) ); if(ibTag!="") { var isClose = false; var obj_ta = document.getElementById("body"); obj_ta.focus(); if ( (ua_vers >= 4) && is_ie && is_win ) { var rng = document.selection.createRange(); rng.colapse; rng.text = ibTag; } else if ( obj_ta.selectionEnd>=0 ) { var ss = obj_ta.selectionStart; var st = obj_ta.scrollTop; var es = obj_ta.selectionEnd; if (es < 0) { es = obj_ta.textLength; } var start = (obj_ta.value).substring(0, ss); var end = (obj_ta.value).substring(es, obj_ta.textLength); obj_ta.value = start + ibTag + end; var p=0; var ent=0; while(p!=-1) { p=ibTag.indexOf('\n',p); if(p!=-1) { p++; ent++; } } var cpos = ss + (ibTag.length)-ent; obj_ta.selectionStart = cpos; obj_ta.selectionEnd = cpos; obj_ta.scrollTop = st; } obj_ta.focus(); return isClose; } } </script> All, So I have the following code. It works great. When I add this: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> It doesn't work. I need it for some aspects of my CSS to work. The code that works without that is: Code: <html> <script> function resizeAll( ) { var divs = document.getElementsByTagName("div"); for ( var d = 0; d < divs.length; ++d ) { var div = divs[d]; if ( div.className == "fn-area" ) { divid = divs[d].getAttribute("id"); imgid = "Img" + divid; var Div1Width, Div1Height; Div1Width = document.getElementById(divid).offsetWidth; Div1Height = document.getElementById(divid).offsetHeight; document.getElementById(imgid).style.width = Div1Width; document.getElementById(imgid).style.height = Div1Height; } } } </script> <head> </head> <body onLoad="resizeAll()"> <div id="Div1" class="fn-area" style="width:100px;height:100px; border:1px solid black;" onmouseover="document.getElementById('ImgDiv1').style.display='block';" onmouseout="document.getElementById('ImgDiv1').style.display='none';"> <img id="ImgDiv1" src="fnclientlib/styles/artwork/creep_stamp5.gif" style="display:none"/> </div> <div id="Div2" class="fn-area" style="width:300px;height:300px; border:1px solid black;" onmouseover="document.getElementById('ImgDiv2').style.display='block';" onmouseout="document.getElementById('ImgDiv2').style.display='none';"> <img id="ImgDiv2" src="fnclientlib/styles/artwork/creep_stamp5.gif" style="display:none"/> </div> </body </html> |