JavaScript - Javascript / Php Object With Same Java Var's Problem
I have 2 drag-able containers, they are created in PHP objects which are linked to a file.
The working example can be found he 888x7.com The problem that I'm facing is that I can't click test1, and only test2. Now I originally though that it was something to do with them having the same java-script variables, so I renamed all the variables using a unique ID to each object too no success. Here's the code: PHP file: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <?php include 'design/compatability.php'; include 'design/meta.php'; ?> <link rel="stylesheet" type="text/css" href="css.css" /> <title></title> </head> <body> <div id="background"> <img src="images/bg1.jpg" class="stretch" alt="" /> </div> <div id="wrapper"> <?php include 'design/dragdiv.php'; $container = new dragable_box(200, 300, 10, 60, "../designimages/bggrey.png", "test", 1); $container2 = new dragable_box(590, 400, 10, 10, "../designimages/bggrey.png", "test", 2); ?> <?php include 'design/toplinks.php'; ?> </div> <?php include 'design/footer.php'; ?> </body> </html> Code: <?php class dragable_box { public function __construct($width, $height, $x, $y, $bg, $text, $id) { ?> <style type="text/css"> #mydiv<?php echo $id; ?> { z-index:10; background-image:url(<?php echo $bg; ?>); color:#ffffff; width: <?php echo $width; ?>px; height: <?php echo $height; ?>px; position: absolute; top: <?php echo $x; ?>%; left: <?php echo $y; ?>%; cursor:move; padding:10px; } </style> <script language="javascript"> var positionx = <?php echo $x; ?>; var positiony = <?php echo $y; ?>; var setpositionx = window.innerWidth * positionx / 100; var setpositiony = window.innerHeight * positiony / 100; var drag=0; var xdif=0; var ydif=0; var initx=setpositionx; var inity=setpositiony; function begindrag<?php echo $id; ?>(event) { if(drag==0) { floatingd = document.getElementById("mydiv<?php echo $id; ?>"); if(floatingd.style.left=="") { floatingd.style.left=initx; } if(floatingd.style.top=="") { floatingd.style.top=inity; } prex=floatingd.style.left.replace(/px/,""); prey=floatingd.style.top.replace(/px/,""); drag=1; xdif = event.clientX-prex; ydif = event.clientY-prey; } else { drag=0; } } function mousepos<?php echo $id; ?>(event) { floatingd = document.getElementById("mydiv<?php echo $id; ?>"); if(drag==1) { floatingd.style.left = event.clientX-setpositionx+"px"; floatingd.style.top = event.clientY-setpositiony+"px"; } } </script> </HEAD> <BODY onMouseMove="mousepos<?php echo $id; ?>(event)" > <div id='mydiv<?php echo $id; ?>' onClick="begindrag<?php echo $id; ?>(event)" > <?php echo $text; echo $id; ?> </div> <?php } } ?> I need help being able to select both DIV's, can anyone point me in the right direction? Thanks Similar TutorialsHey guys, I've just started with javascript so please, be gentle I am making a wordpress plug-in which puts a banner-rotator on the front page which is able to load both images and flvs'. It has a carousel menuand the images/objects are loaded as you hover over the thumbnails. I have made an js array in a php loop so that every element of the menu list gets assigned a different onMouseOver function when it is generated. Because I was not able to change FlashVars with js I have put the whole object embed code in one variable and insert that in a div with innerHTML when mouseOver. This works fine in firefox but not at all in any other browsers!! What can I do? The website is located at: www.mediapod.org/jwp Here is the code: Code: function wp_main_player() { global $wpdb; $noChartsID = $wpdb->get_col($wpdb->prepare("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id = 5")); $noCharts = count($noChartsID); ?> <div class="box" style="height:350px;"> <div id="maind" style="height:280px;"> <div id="icont"> <a id="link" href="#"><img name="main" height="280" width="560" src="" /></a> </div> <div id="fcont" style="display:none; width:100%; height:100%; background:#fff;"> </div> </div> <a class="pprev" style="float:left; width:10px; height:60px; margin-top:10px;" href="javascript:void(0)"></a> <div class="player" style="float:left; margin-top:11px; width:540px !important;"> <script> var myCode = []; </script> <ul style="float:left;"> <?php if ($noCharts > 0) { for ($i = 0; $i < $noCharts; $i += 1) { $posts = $wpdb->get_row("SELECT * FROM wp_posts WHERE id = $noChartsID[$i]", ARRAY_A); $link = $wpdb->get_row("SELECT * FROM wp_postmeta WHERE post_id = $noChartsID[$i] AND meta_key ='link'", ARRAY_A); $link = $link['meta_value']; $image = $posts['post_content']; $flv = strpos($image, 'flv:'); if ($flv==1){ $flv = str_replace("-flv:", "", $image); $flv = substr(rstrstr($flv, '-img:'),0 ,-6); $image = substr(strstr($image, '-img:'), 5); ?> <script> myCode[<?php echo $i; ?>]=<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="560" height="280" id="FlashXMLShoutcastRadioPlayerV4.0" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/FLVPlayer_Progressive.swf" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="wmode" value="opaque" ></param> <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/Corona_Skin_1&streamName=<?php echo $flv; ?>&autoPlay=true&autoRewind=false" /> <param name="bgcolor" value="#111111" /> <embed bgcolor="#111111" wmode="opaque" src="http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/FLVPlayer_Progressive.swf" menu="false" FlashVars ="&MM_ComponentVersion=1&skinName=http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/Corona_Skin_1&streamName=<?php echo $flv; ?>&autoPlay=true&autoRewind=false" quality="high" width="560" height="280" name="FlashXMLShoutcastRadioPlayerV4.0" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>; </script> <li class="p_img"><img onmouseover="document.getElementById('icont').style.display='none';document.getElementById('fcont').style.display=''; document.getElementById('fcont').innerHTML=myCode[<?php echo $i; ?>]; document.main.src='<?php echo $image;?>'; document.getElementById('link').href='<?php echo $link;?>';" src="<?php echo $image;?>" height="52" width="102" /></li> <?php } else { ?> <li class="p_img"><img onmouseover="document.getElementById('icont').style.display=''; document.getElementById('fcont').innerHTML=''; document.getElementById('fcont').style.display='none'; document.main.src='<?php echo $image;?>'; document.getElementById('link').href='<?php echo $link;?>';" src="<?php echo $image;?>" height="52" width="102" /></li> <?php } } } ?> </ul> </div> <a class="pnext" style="float:right; width:10px; height:60px; margin-top:10px;" href="javascript:void(0)"></a> <script type="text/javascript"> jQuery(function() { jQuery(".player").jCarouselLite({ btnNext: ".pnext", btnPrev: ".pprev", speed: 300, visible: 5 }); }); </script> </div> <?php } It is an absolute mess Thank you. I am not very experienced at javascript. Having trouble with some I used for a google map on some of the pages on company site. Appreciate any assistance someone out there could give. If you go to http://www.ghd.com/global/locations/...nsland/cairns/ you can see the error. Get the debug message: an error occurred on this page: Line: 74 Character: 9 Error: GetElementById(....)' is null or not an object The map is actually in a i frame For some reason in ie 6 this script error is popping up when the page loads, but does not when not shown within a iframe http://www.ghd.com/map/cazenovia.html Hi , I have a an application which works fine on XP IE6, but the same application throws error " Java Script Error Style is null or not an object" on XP IE8 and Windows 7 . Please help me to resolve this issue. Please Tahnks in advance Hi Script Experts I am facing issue in below code for Brisilia time zone.(GMT-3). Issue comes in October month only. It is going tobig loop. I am not getting how Date object is behaving here. Thanks in advance Pranav Sharma *********************************** <script type="text/javascript"> var nDate; var nCurrentYear = 2011; var nCurrentMonth = 10; nYear=2011; nMonth=10; var date = new Date(nYear, nMonth-1, 1); document.write('Month:'+date.getMonth() +':CurrentMonth:'+nCurrentMonth); while (date.getMonth() == nCurrentMonth-1) { nDate = date.getDate(); document.write(date.toDateString()); date = new Date(nCurrentYear, date.getMonth(), date.getDate()+1); } </script> ********************************** Hi everybody! I've a problem and I'm not able to solve it alone. I want to invoke java methods of a self written java programm with javascript. I found something like a tutorial (http://stanislavvitvitskiy.blogspot....lications.html), but it has not worked. I put my class file in a jar file and when I want to load it in javascript i get an error. I tried it this way: var url = new java.net.URL('C:/java_js' + '/xultest.jar'); var cl = new java.net.URLClassLoader(url); var aClass = java.lang.Class.forName("com.stan.XULDemo", true, cl); var inst = aClass.newInstance(); // Calling 'sum' function from java var a = inst.sum(2, 3); alert(a); // Will alert '5' Can anyone please help, and say to me what's wrong about it? Or does anyone have another aproach to call java methods with javascript? cheers, Martin Hello, I'm making a Javascript implementation for my Java program. But I'm having a proplem. I want to call my own Java code from the Javascript script. Is that possible? Thanks, enderp Not much programming experience, but some C++ and Python. I would like to make a web page that 1. flashes and image for 1 second 2. flashes a a pair of images for 1 second 3. displays an image and waits 4. Wait for a certain correct keystroke to be entered. 5. Repeat 1-4 a few hundred times. ^The above would iterate through a loop, say of 300 counts, and sub-iterate through an array of images, say 30, going through all 30 images 10 times for example. Oh, and the array elements would be displayed in random order. Also, I would like to keep track of errors (wrong keystroke) and time it took to enter correct keystroke. I would prefer that this webpage work on the iphone, even older ones. Java is limited on iphone? I tried playing a Java chess game and had no luck on iphone. So, would I be able to do this using Javascript? If not, Java would be best? As I said, I would prefer iphone compatibility, but it is not required. I just want to know which one I should use before I bury my nose in a book about programming Java or Javascript. Can you place java code in an external javascript file (.js). For example can I do the following in my xx.js file. $(document).ready(function(){ <% execute some java code here %> ...execute some javascript code here... }) Can I do the above? Another question ... I know <% %> is to execute java code inside html. But what does <%-- - -%> mean? Thanks for any help. I'm new to java and I'm not quite sure what I am doing wrong here. I am trying to write a java program for the following question..... Write a program that has variables to hold three test scores. the program should ask the user to enter three tst scores and then assign the values entered to the variables. the program should display the average of the test scores and the letter grade that is assigned for the test score average. use the following grading system 90-100 A 80-89 B 70-79 C 60-69 D Below 60 F Here is what I have so far...When I compile I get the following error "Grades.java:41: variable totalgrade might not have been initialized System.out.println("Over all you have" + totalgrade); 1 error" Code: import javax.swing.*; import java.util.*; public class Grades { public static void main (String[] args) { int score1; int score2; int score3; int totalscore; double grade=0; char totalgrade; Scanner keyboard = new Scanner(System.in); System.out.println("Please enter your first test score."); score1 = keyboard.nextInt(); System.out.println("Please enter your second test score."); score2 = keyboard.nextInt(); System.out.println("Please enter your third test score."); score3 = keyboard.nextInt(); totalscore = score1 + score2 +score3; grade = totalscore /3; System.out.println("Your average is a" + grade); if (grade>= 90) { totalgrade = 'A'; } else if (grade>= 80){ totalgrade = 'B'; } else if (grade >= 70) { totalgrade = 'C'; } else if (grade >= 60) { totalgrade = 'D'; } else if (grade >59){ totalgrade = 'F'; } System.out.println("Over all you have" + totalgrade); }//end main method } //end class Hiya all, I'm new here and fairly new to JavaScript and coding - one of my teachers said it would be a fun language to learn to help me out when our GCSE's come up so I thought I would give it a go. I am currently trying to make a roulette style of game - the first phase though is fairly basic. I want the user to click a number and then to be told if it is right or wrong and update their chips. Currently I am using a fixed number whilst building up the script for testing purposes - I will change that to a random number later on. So far I have broke the code down and the parts that work are where the user function is not there(The buttons) so i assume the function for changing a variable to what the user picks is broke. Although when printing that function it says that it has changed. Like I said I'm new here so if this is not where to post for help just let me know and point me in the wrong direction any help would be much appreciated The code is : Code: <html> <body> <script language='JavaScript'> var numbers = new Array(39); numbers[0] = "BLANK IF THIS COMES UP PANIC AND RUN"; numbers[1] = "1"; numbers[2] = "2"; numbers[3] = "3"; numbers[4] = "4"; numbers[5] = "5"; numbers[6] = "6"; numbers[7] = "7"; numbers[8] = "8"; numbers[9] = "9"; numbers[10] = "10"; numbers[11] = "11"; numbers[12] = "12"; numbers[13] = "13"; numbers[14] = "14"; numbers[15] = "15"; numbers[16] = "16"; numbers[17] = "17"; numbers[18] = "18"; numbers[19] = "19"; numbers[20] = "20"; numbers[21] = "21"; numbers[22] = "22"; numbers[23] = "23"; numbers[24] = "24"; numbers[25] = "25"; numbers[26] = "26"; numbers[27] = "27"; numbers[28] = "28"; numbers[29] = "29"; numbers[30] = "30"; numbers[31] = "31"; numbers[32] = "32"; numbers[33] = "33"; numbers[34] = "34"; numbers[35] = "35"; numbers[36] = "36"; numbers[37] = "0"; numbers[38] = "00"; var goldennum = numbers[20]; //roullete number document.write(goldennum +"</br>"); var userpot = 500; // The amount of credits or chips the user has //var userpot = userpot*38; //document.write(userpot); user pot working calc var usernum = 200; //user betting number function button00(){ var usernum = 00; } function button0(){ var usernum = 0; } function button3(){ var usernum = 3; } function button6(){ var usernum = 6; } function button9(){ var usernum = 9; } function button12(){ var usernum = 12; } function button15(){ var usernum = 15; } function button18(){ var usernum = 18; } function button21(){ var usernum = 21; } function button24(){ var usernum = 24; } function button27(){ var usernum = 27; } function button30(){ var usernum = 30; } function button33(){ var usernum = 33; } function button36(){ var usernum = 36; } function button2(){ var usernum = 2; } function button5(){ var usernum = 5; } function button8(){ var usernum = 8; } function button11(){ var usernum = 11; } function button14(){ var usernum = 14; } function button17(){ var usernum = 17; } function button20(){ var usernum = 20; //document.write("</br></br></br>" + usernum + "</br></br></br>"); } function button23(){ var usernum = 23; } function button26(){ var usernum = 26; } function button29(){ var usernum = 29; } function button32(){ var usernum = 32; } function button35(){ var usernum = 35; } function button1(){ var usernum = 1; } function button4(){ var usernum = 4; } function button7(){ var usernum = 7; } function button10(){ var usernum = 10; } function button13(){ var usernum = 13; } function button16(){ var usernum = 16; } function button19(){ var usernum = 19; } function button22(){ var usernum = 22; } function button25(){ var usernum = 25; } function button28(){ var usernum = 28; } function button31(){ var usernum = 31; } function button34(){ var usernum = 34; } function runnums(){ //function to run the if the users bet is equal to the roulette number if(usernum == goldennum){ var userpot=500; userpot = userpot * 38; document.write(userpot); document.write( " YOU ARE A WINNER "); } else{ var userpot = 500; userpot= userpot - userpot; document.write ("You have " + userpot + " credits left "); document.write ( " YOU ARE A LOOOOOSER "); } } </script> <br> <br> <br> <br> <br> <br> <br> <input type="button" name="Button" value="00" onclick="button00()"> <input type="button" name="Button3" value="3" onclick= "button3()"> <input type="button" name="Button6" value="6" onclick= "button6()"> <input type="button" name="Button9" value="9" onclick= "button9()"> <input type="button" name="Button12" value="12" onclick="button12()"> <input type="button" name="Button15" value="15" onclick="button15()"> <input type="button" name="Button18" value="18" onclick="button18()"> <input type="button" name="Button21" value="21" onclick="button21()"> <input type="button" name="Button24" value="24" onclick="button24()"> <input type="button" name="Button27" value="27" onclick="button27()"> <input type="button" name="Button30" value="30" onclick="button30()"> <input type="button" name="Button33" value="33" onclick="button33()"> <input type="button" name="Button36" value="36" onclick="button36()"> <p> <input type="button" name="Button0" value="0" onclick="button0()"> <input type="button" name="Button2" value="2" onclick="button2()"> <input type="button" name="Button5" value="5" onclick="button5()"> <input type="button" name="Button8" value="8" onclick="button8()"> <input type="button" name="Button11" value="11" onclick="button11()"> <input type="button" name="Button14" value="14" onclick="button14()"> <input type="button" name="Button17" value="17" onclick="button17()"> <input type="button" name="Button20" value="20" onclick="button20()"> <input type="button" name="Button23" value="23" onclick="button23()"> <input type="button" name="Button26" value="26" onclick="button26()"> <input type="button" name="Button29" value="29" onclick="button29()"> <input type="button" name="Button32" value="32" onclick="button32()"> <input type="button" name="Button35" value="35" onclick="button35()"> <p> <input type="button" name="Button1" value="1" onclick="button1()"> <input type="button" name="Button4" value="4" onclick="button4()"> <input type="button" name="Button7" value="7" onclick="button7()"> <input type="button" name="Button10" value="10" onclick="button10()"> <input type="button" name="Button13" value="13" onclick="button13()"> <input type="button" name="Button16" value="16" onclick="button16()"> <input type="button" name="Button19" value="19" onclick="button19()"> <input type="button" name="Button22" value="22" onclick="button22()"> <input type="button" name="Button25" value="25" onclick="button25()"> <input type="button" name="Button28" value="28" onclick="button28()"> <input type="button" name="Button31" value="31" onclick="button31()"> <input type="button" name="Button34" value="34" onclick="button34()"> <input type="button" name="Place Bets" value="Place Bets" onclick="runnums()"> </body> </html> The problem that I am having is that I want to have a page that displays a clock by calling a .js file function. This is shown below: Actual page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/ xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <?php session_start(); include "../../../u0000700/wes_ica_08_09/wes_ica.inc"; ?> <head> <link rel="stylesheet" type="text/css" href="wes_ica.css" /> <script type="text/javascript" src="wes_ica.js"></script> <script type="text/javascript" src="../../../u0000700/wes_ica_08_09/wes_ica.js"></script> <title>Clock</title> </head> <body onload="globalclock()"> <form> <p><object height="200" width="200" type="image/svg+xml" data="wes_ica.svg"> </object></p> <p><input type="text" id="globalclock" /></p> </form> The code it calls in the "../../../u0000700/wes_ica_08_09/wes_ica.js" file is : function globalclock() { var clocktime = new Date(); clocktime.setMinutes(clocktime.getMinutes()+cities[city][1]); maketimedisp(clocktime); timestring=""; timestring+=cities[city][0]; timestring+=" - "; switch (dow) { case "n": timestring=timestring; break; case "s": timestring=timestring+startdayofweek.substring(0,3)+" "; break; case "f": timestring=timestring+startdayofweek+" "; break; default: timestring="Error"; } switch (cdate) { case "n": break; case "a": case "b": case "c": case "d": case "f": case "g": case "h": case "i": case "k": case "l": case "m": case "o": timestring=timestring+startday; break; case "j": case "e": case "p": if (startday>9) { timestring=timestring+startday } else{ timestring=timestring+"0"+startday } break; default: timestring="Error"; } if (startday<20) { de=dayending[startday]; } else { de=dayending[startday%10]; } switch (cdate) { case "n": case "b": case "d": case "e": case "g": case "i": case "j": case "l": case "o": case "p": break; case "a": case "c": case "f": case "h": case "k": case "m": timestring=timestring+de; break; default: timestring="Error"; } switch (cdate) { case "n": break; case "a": case "b": case "f": case "g": case "k": case "l": timestring=timestring+" "+startmonth+" " break; case "c": case "d": case "h": case "i": case "m": case "o": timestring=timestring+" "+startmonth.substring(0,3)+" " break; case "e": case "j": if (start31month>9) { cmonth=start31month } else { cmonth="0"+start31month; } timestring=timestring+"/"+cmonth+"/" break; case "p": if (start31month>9) { cmonth=start31month } else { cmonth="0"+start31month; } timestring=timestring+"/"+cmonth+" " break; default: timestring="Error"; } syear=startyear; switch (cdate) { case "n": case "k": case "l": case "m": case "o": case "p": break; case "a": case "b": case "c": case "d": case "e": timestring=timestring+syear+" "; break; case "f": case "g": case "h": case "i": case "j": yearstring=""+syear; tempyear=yearstring.match(/..$/); timestring=timestring+tempyear+" "; break; default: timestring="Error"; } switch (ctime) { case "n": break; case "a": case "b": case "c": case "d": timestring=timestring+starthour; break; case "e": case "f": timestring=timestring+start24hour; break; default: timestring="Error"; } switch (ctime) { case "n": break; case "a": case "b": case "c": case "d": case "e": case "f": if (startminute<10) { sminute=":0"+startminute; } else { sminute=":"+startminute; } timestring=timestring+sminute; break; default: timestring="Error" } switch (ctime) { case "n": case "b": case "d": case "f": break; case "a": case "c": case "e": if (startsecond<10) { ssecond=":0"+startsecond; } else { ssecond=":"+startsecond; } timestring=timestring+ssecond; break; default: timestring="Error" } switch (ctime) { case "n": case "c": case "d": case "e": case "f": break; case "a": case "b": timestring=timestring+" "+startmeridian;break; default: timestring="Error"; } document.getElementById("globalclock").value = timestring; id = setTimeout("globalclock()", 1000); } The problem that I am having is that I have to declare 3 variables in the text/javascript" src="wes_ica.js file. These variables a dow "f" or "s" cdate one from "a" to "p" except "n" ctime one from "a" to "f" These variables are then used to make the globalclock function work. I just do not know how to lay this out on the page. Things such as the header etc. Do they have to be in a function? The layout that I have so far is this: var dow = ("f","s"); var cdate = ("a","b","c","d","e","f","g","h","i","j","k","l","m","o","p"); var ctime = ("a","b","c","d","e","f"); 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 redoing a web site. We added some pop up menus to consolidate the navigation. I created the template in fireworks MX 2004. The pop up menu has no errors in Firefox. I have some problems in IE. When I first uploaded the page it wanted to know I should load blocked content. Keep in mind my IE 8 setting were set on default. Now without me changing IE settings it just does not load the pop up menus. Can anyone help me with making the code more compatible with IE. I would rather not have it ask me if I want to load blocked content. I also want the menus to pop up when visitors wave over them with the mouse. Here is the domain for the site. Kitchen Remodels Chino Kitchen & Bathroom Remodeling Senior Baths Wave your mouse over some of the blue buttons. The kitchens, cabinets, bathrooms and home improvement buttons should have a pop up when waving the mouse over them. Here is the code in the page. Code: <script language="JavaScript1.2" src="jss/menu.js"></script> <script language="JavaScript1.2" src="jss/mm_menu.js"></script> </head> <body> <script language="JavaScript1.2">mmLoadMenus();</script> Here is the java script code. Code: // JavaScript Document <!-- function mmLoadMenus() { if (window.mm_menu_0725085737_0) return; window.mm_menu_0725085737_0 = new Menu("root",205,20,"Verdana, Arial, Helvetica, sans-serif",14,"#000000","#ffffff","#cccccc","#0099cc","left","middle",3,0,1000,-5,7,true,true,true,0,true,true); mm_menu_0725085737_0.addMenuItem("Kitchen Remodeling","location='kitchen-remodeling.php'"); mm_menu_0725085737_0.addMenuItem("Budget Kitchen Remodeling","location='budget-kitchen-remodeling.php'"); mm_menu_0725085737_0.hideOnMouseOut=true; mm_menu_0725085737_0.menuBorder=1; mm_menu_0725085737_0.menuLiteBgColor='#ffffff'; mm_menu_0725085737_0.menuBorderBgColor='#0098a3'; mm_menu_0725085737_0.bgColor='#ffffff'; window.mm_menu_0725090038_1 = new Menu("root",145,20,"Verdana, Arial, Helvetica, sans-serif",14,"#000000","#ffffff","#cccccc","#0099cc","left","middle",3,0,1000,-5,7,true,true,true,0,true,true); mm_menu_0725090038_1.addMenuItem("Kitchen Cabinets","location='kitchen-cabinets.php'"); mm_menu_0725090038_1.addMenuItem("Cabinet Refinishing","location='cabinet-refinishing.php'"); mm_menu_0725090038_1.addMenuItem("Cabinet Refacing","location='cabinet-refacing.php'"); mm_menu_0725090038_1.hideOnMouseOut=true; mm_menu_0725090038_1.menuBorder=1; mm_menu_0725090038_1.menuLiteBgColor='#ffffff'; mm_menu_0725090038_1.menuBorderBgColor='#0098a3'; mm_menu_0725090038_1.bgColor='#ffffff'; window.mm_menu_0725090215_2 = new Menu("root",167,20,"Verdana, Arial, Helvetica, sans-serif",14,"#000000","#ffffff","#cccccc","#0099cc","left","middle",3,0,1000,-5,7,true,true,true,0,true,true); mm_menu_0725090215_2.addMenuItem("Bathroom Remodeling","location='bath-remodeling.php'"); mm_menu_0725090215_2.addMenuItem("Walk in Tubs","location='walk-in-tubs.php'"); mm_menu_0725090215_2.hideOnMouseOut=true; mm_menu_0725090215_2.menuBorder=1; mm_menu_0725090215_2.menuLiteBgColor='#ffffff'; mm_menu_0725090215_2.menuBorderBgColor='#0098a3'; mm_menu_0725090215_2.bgColor='#ffffff'; window.mm_menu_0725090242_3 = new Menu("root",161,20,"Verdana, Arial, Helvetica, sans-serif",14,"#000000","#ffffff","#cccccc","#0099cc","left","middle",3,0,1000,-5,7,true,true,true,0,true,true); mm_menu_0725090242_3.addMenuItem("Home Improvement","location='home-improvement.php'"); mm_menu_0725090242_3.addMenuItem("Window Replacement","location='window-replacement.php'"); mm_menu_0725090242_3.addMenuItem("Furniture Refinishing","location='furniture-refinishing.php'"); mm_menu_0725090242_3.addMenuItem("General Contractor","location='about.php'"); mm_menu_0725090242_3.hideOnMouseOut=true; mm_menu_0725090242_3.menuBorder=1; mm_menu_0725090242_3.menuLiteBgColor='#ffffff'; mm_menu_0725090242_3.menuBorderBgColor='#0098a3'; mm_menu_0725090242_3.bgColor='#ffffff'; mm_menu_0725090242_3.writeMenus(); } // mmLoadMenus() //--> hi i have 4 check boxes chk1 , chk2,chk3,chk4 also textbox1 , textbox2 textbox3 textbox4 when selecting one chk box (chk1) textbox1=45 textbox44=45 when chk1 checked if textbox2=56 textbox45=56 when chk2 checked plz give me code sample for me plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz give me a answer Hi All.....I am new to javascript coding ...I am unable to forward from my jsp to servlet file via javascript below is my code.... [JSP CODE] <html> <body> <form action="Bean" method="get" name="form1"> <ul> <li><a onclick="javascript:view('vprod')" name="vprod">View</a></li> </ul> [Script Code] function view(value) { alert(value); document.form1.action="/Bean"; document.form1.submit(); } Please can one help me in this regard.....Thanks in Advance Posted this in the wrong forum earlier. I'm pretty new to Java, so i may be missing something simple, but here is my problem; On this page http://keithfrenchdesigns.com/ under the work area the gallery images are showing no problem, but on the sideways scrolling page http://keithfrenchdesigns.com/sideways on page 4 it's not showing the gallery image like the div is missing(it's not), but if you click on one of the links it will pull up a blank. It also will not scroll past page 4 to page 5(or if you move the gallery area to say, page 2, it won't scroll any further either). Like the script for the gallery area is interfering with the sideways scrolling script. Please ignore the design on the site as it is just there so i can see how everything reads. Any help would be appreciated. How can i display a javascript object having [CODE]var myVarr = [{"name":"xyz","age":21}, {"name":"cde","age":25}].[CODE] in a table in jsp page? Regards, Anas I am doing my homework for my class, and I don't usually ask for this much help because I get most of them done by myself. However, I am having a really hard time to understand this time. I have lots lots of questions...I tried to follow the instructions that I got from my professor, but it seems not clear enough to me... If anyone can fix or add on my codes, I will be really really appreciated....and here is the instructions and my codes.. If the form validates, instead of returning true, call the GetValues() function followed by the DisplayOutput() function. so, I changed result true to calling functions like this, Code: if (blnError == true){ return false; } else { DisplayOutput(); GetValues(); } In the .js file, create a PortraitOrder class using the following specifications Properties: portrait, copies, size, buyer Method: CalculateCost () -- determines the size (radio buttons) and then mutiplies the related cost by the number of copies Code: function PortraitOrder(){ var cost; this.copies = ""; this.portrait = ""; this.size = ""; this.buyer = ""; var CalculateCost = { met1 : function () { if(size == 0){ cost = this.copies * 10 } else if(size ==1){ cost = this.copies * 20 } else if(size ==2){ cost = this.copies * 10 } else if(size ==3){ cost = this.copies * 30 } else{ cost = this.copies * 20 } } } } Create a new instance of the class named portraits as a global variable in the ,js file -" I don't see why I need this. So I did not create Create a GetValues() function that will retrieve the values from the form fields (document.forms[0].element.value) and assign them the properties of the instance of the PortraitOrder class. use a for loop to retrieve the value from the radio buttons use the prototype property to add a new property named email to the instance of the class retrieve the value from the form field and assign it to the new email property Code: function GetValue(){ this.copies = document.forms[0].Copies.value; this.buyer = document.forms[0].Buyer.value; var file = document.getElementsByName('Filename'); for(var i = 0; i < file.length; i++){ if(file[i].checked){ this.portrait = file[i].value; } } var sizes = document.getElementsByName('Size'); for(var i = 0; i < sizes.length; i++){ if(sizes[i].checked){ this.size = sizes[i].value; } } GetValue.prototype.email = document.forms[0].Email.value; } Create a DisplayOutput() function that calls the CalculateCost () method for the current instance of the class. displays the image using the value from the portrait property which contains the filename. Be sure to include height and width (and that would be why all of the images had to be the same dimension. These values can be hardcoded. The filename, however, may NOT be hard coded.. it must use the object.property format. displays the buyer, email, copies, size, and cost using the object.property format (document.forms[0].element.value is not permitted) The cost must be formatted as ##.## where # represents a number (Hint: Use a method of the Number class). It is NOT okay just to concatenate .00 to then end of the cost. Code: function DisplayOutput(){ CalculateCost.met1(); document.write("buyer: " + this.buyer); document.write("Email: " + email); document.write("Portrait: " + this.portrait); document.write("Copies: " + this.copies); document.write("Cost: " + "$"+cost.toFixed(2)); document.write("Thank you"); } The order form must include the site's header and footer and coordinate with the rest of the site. There is no form processing file, everything is done in the .js file. You may think like, this is horrible codes. And yes, it is. I know probably this is totally odd. This is why I came here for ask help. Also, I spent days to tried, but I could not get any idea...Anyone please help me on this? |