Jump to content

Search the Community

Showing results for tags 'JAVASCRIPT'.

The search index is currently processing. Current results may not be complete.
  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. Nice be with you everyone! After I've learned setting JQuery selectors in a variables for optimisation.Example: $(document).ready(function(){ $("form").submit(function(){ var a=$("#position"); var b=$("#job"); var c=$("input#religion"); var d="Others"; if (a.val() == "" && b.val() == d ){ b.val("").focus(); return false; } if (c.val() == d){ c.val("").focus(); return false; } }); }); My related question is: Can I set JQuery methods in a variables for optimisation?Example: $(document).ready(function(){ var a=attr("maxlength", 32); $("#specialty").a; }); Thank you.
  2. Currently I'm learning Ajax with Java.The innerHTML method works when I'm retrieving simple string data from the servlet, and when I need to update only one HTML element.Since I have the need to update more HTML elements it occurred to me that I can use JSON object with several properties (HTML tag data for each element needed updating).After trying that I've noticed that innerHTML method doesn't work, when I try to process the retrieved data in the Callback function.My question is, why is this happening?Did someone had a similar problem when using JSON with Javascript.Just for the record, when I use innerText method I successfully update the HTML elements with JSON properties data, only they update as text and that's what I don't need. (See the video) Thank You.
  3. Hello,I'm new here and to be honest it's the first time I am writing into a Forum. Until now I was only reading through various posts which considerd the same problem as I had. But now I really have no idea what to search and where my problem is. Down here is the PHP Script I have written for a Prom Vote in a nearby school. It would be really great if someone could find my mistake and correct me. <!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <?php$con = mysql_connect("localhost","xxx","xxxxxxxxx");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db(bgschwechat) or die( "Unable to select database");$abfrage = "SELECT * FROM teilnehmer";$ergebnis = mysql_query($abfrage);$abfrage2 = "SELECT * FROM teilnehmer";$ergebnis2 = mysql_query($abfrage2);echo '<script>';echo 'var stimmzahl = array();';echo 'var name = array();';echo '</script>';while($row = mysql_fetch_object($ergebnis)) { echo '<script>'; echo 'stimmzahl['; echo $row->id; echo '] = 0; '; echo 'name['; echo $row->id; echo '_name'; echo '] = '; echo $row->name; echo '; '; echo 'function '; echo $row->id; echo 'plus() {'; echo 'stimmzahl['; echo $row->id; echo ']++; '; echo 'document.getElementById("'; echo $row->id; echo 'result").innerHTML = stimmzahl['; echo $row->id; echo ']; '; echo '}'; echo 'function '; echo $row->id; echo 'minus() {'; echo 'stimmzahl['; echo $row->id; echo ']--; '; echo 'document.getElementById("'; echo $row->id; echo 'result").innerHTML = stimmzahl['; echo $row->id; echo ']; '; echo '}'; echo '</script>'; } echo '<table class="teilnehmer-liste">'; while($row = mysql_fetch_object($ergebnis2)) { echo '<tr>'; echo '<td>'; echo $row->name; echo '</td>'; echo '<td>'; echo '<button id="'; echo $row->id; echo 'plus" onClick= "function '; echo $row->id; echo 'plus()">+</button>'; echo '</td>'; echo '<td>'; echo '<button id="'; echo $row->id; echo 'minus" onClick=" function '; echo $row->id; echo 'minus()">-</button>'; echo '</td>'; echo '<td>'; echo '<div id="'; echo $row->id; echo 'result">/</div>'; echo '</td>'; echo '</tr>';}mysql_free_result($ergebnis);?></table> </body> </html> The PHP Code works pretty fine but I am not happy with the result because the + and - Buttons don't work :/ Here's the result of the PHP Code in HTML : <!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script>var stimmzahl = array();var name = array();</script><script>stimmzahl[1] = 0; name[1_name] = Test Person 1; function 1plus() {stimmzahl[1]++; document.getElementById("1result").innerHTML = stimmzahl[1]; }function 1minus() {stimmzahl[1]--; document.getElementById("1result").innerHTML = stimmzahl[1]; }</script><script>stimmzahl[2] = 0; name[2_name] = Test Person 2; function 2plus() {stimmzahl[2]++; document.getElementById("2result").innerHTML = stimmzahl[2]; }function 2minus() {stimmzahl[2]--; document.getElementById("2result").innerHTML = stimmzahl[2]; }</script><table class="teilnehmer-liste"><tr><td>Test Person 1</td><td><button id="1plus" onClick= "function 1plus()">+</button></td><td><button id="1minus" onClick=" function 1minus()">-</button></td><td><div id="1result">/</div></td></tr><tr><td>Test Person 2</td><td><button id="2plus" onClick= "function 2plus()">+</button></td><td><button id="2minus" onClick=" function 2minus()">-</button></td><td><div id="2result">/</div></td></tr></table> </body> </html> It would be really great if someone could help me I need to find a solution as soon as possible because I only have rare time to finish the project. Thanks in advance. ASavic P.S. Here's the Website Link - http://www.cryze.com/bgschwechat/test.php - sometimes offline because it's in development. ^^
  4. Nice be with you everyone! While reading http://www.w3schools...s_obj_array.asp I've noticed two confusing arrays... 2: Condensed: var myCars=new Array("Saab","Volvo","BMW"); 3: Literal: var myCars=["Saab","Volvo","BMW"]; My question is: What is the difference between Literal arrays & Condensed Arrays? & which of them is better to use? Thank you.
  5. Nice be with you everyone! My problem is: Every time I click "#show" my prompt is continuously appearing though I click OK, cancel or close? Here is my code: <script type="text/javascript" src="javascripts/jquery-1.9.1.min.js"></script> <script> $(document).ready(function(){ $("#weight").hover(function(){ $("#show").css("display", "block"); }, function(){ $("#show").css("display", "none"); $("#show").mouseenter(function(){ $(this).data("mouse", "enter"); if ($(this).data("mouse") == "enter"){ $(this).css("display", "block").click(function(){ var converted = prompt ("Convert poud to kilograms:","")answer = converted * 0.45359237; // 1 lb = 0.45359237 kganswer = answer.toFixed(2); if (!isNaN(converted)) { // If not illegal number if (converted != 0) { // If not empty valuealert(converted + " poud = " + answer + " kilograms");$("#weight").val(answer); } else alert("Error: Empty value!"); // If empty value } else alert("Error: Illegal number!"); // If illegal number });}});});}); </script> Take a look my attached picture. Thank you.
  6. Nice be with you everyone! My question is: What is the usage of console.log in jQuery? Thank you.
  7. Nice be with you everyone! My problem is how to call javascript function inside jquery? <script type="text/javascript" src="javascripts/jquery-1.9.1.min.js"></script> <script> function li(){ var A=$(this).text();$(.text(A.substr(0,19)); $("#job").removeAttr("name value"); $("#position").attr({"name":"jobApplied", "value":A }); $(.css({"color":"#000", "background":"#fff" }); $(C).css({"color":"#a9a9a9", "background":"#d9d9d9"}).text(D); $("#job").css({"background":"#d9d9d9" }); } $(document).ready(function(){$("#ul1 li ul a").on("click",function(){ var B="#cut1", C="#cut2", D="Medical positions"; /* I want to call function li() here but it is not working */ });}); $(document).ready(function(){$("#ul2 li ul a").on("click",function(){ var B="#cut2", C="#cut1", D="Technical positions"; /* I want to call function li() here but it is not working */ });}); </script> Thank you.
  8. Hi All, I am having issues with my search bar on my website www.uHeadphones.Com. When I click the search bar to input a keyword or anything it is refreshing my index page. If I am on my product page it is refreshing back to my index page. Pretty much it is acting as my logo button in the top left of the header. Can someone please help me out with this. I can't figure out what is wrong with the code. I am decent with HTML but not so great with JavaScript. Below I am going to post my header HTML code as with as my script.js JavaScript code. HTML in Header: actual search bar code in red <!-- START HEADER --><script type="text/javascript" src="themes/default/inc/scripts.js"></script><script type="text/javascript" src="themes/default/inc/jquery.megamenu.js"></script><script language="JavaScript" src="https://seal.networksolutions.com/siteseal/javascript/siteseal.js" type="text/javascript"></script> <div class="searcharea"> <div class="custom-search" id="ctl00_ctl02_searchBox"> <input type="text" class="textbox custom-search-field" type="text" maxlength="100" id="search-textbox" class="textbox" value="Enter keyword(s), item #, etc..." onblur="if (this.value == '') {this.value = 'Enter keyword(s), item #, etc...';}" onfocus="if (this.value == 'Enter keyword(s), item #, etc...') {this.value = '';}" /> <input type="image" class="custom-search-button" alt="Go" src="themes/default/images/btn_header_search.gif" id="search-button" name="ctl00$ctl02$go" /> </div></div> JavaScript: Script.JS file:jQuery(function(){ var SelfLocation = window.location.href.split('?'); switch (SelfLocation[1]) { case "justify_right": jQuery(".megamenu").megamenu({ 'justify':'right' }); break; case "justify_left": default: jQuery(".megamenu").megamenu(); } }); function loadSearch() { var searchText = document.getElementById("search-textbox"); var searchButton = document.getElementById("search-button"); searchButton.onclick = function() { if (searchText.value != '') { window.location = '/search.aspx?find=' + encodeURIComponent(searchText.value).replace(/%20/g, '+'); return false; } };} MC.addLoadEvent(loadSearch);// Start Simple Text Popup//(function($){// $.fn.scSimpleText = function(options){ // var defaults = { // popCloseTxt : '' // }; //var settings = $.extend({},defaults,options); //return this.each(function(){ // var nextElm = $(this).next(); // var closeElement = $(document.createElement("a")).attr("href","").text(settings.popCloseTxt).addClass("scSimpleTextClose").click(function(e){nextElm.fadeOut("slow"); e.preventDefault();}); //$(this).click(function(e){ // nextElm.fadeIn("slow"); //nextElm.append(closeElement); // e.preventDefault(); // }); // });// }// End Simple Text Popup /**********************************************************************************************************//****************************** Place all add on JS above here, please minify *****************************//**********************************************************************************************************/ /************************************* Document on Load jQuery Functions **********************************/ jQuery(document).ready(function() { // simple text popup for privacy link // $("#simpleTextLink").scSimpleText({popClose:".simpleTextRight"});
  9. I have a main window named worklistManager.jsp. worklistManager.jsp has a pop up window named processManager.jsp. Again, processManager.jsp has another pop up window, named eventLog.jsp. Once again eventLog.jsp has a pop up window named eventUsers.jsp. eventUsers.jsp has a dojox/grid/DataGrid and a button. After selecting a particular row in the grid, then clicking the button, it has to place the value into the textbox of eventLog.jsp after closing eventUsers.jsp. So far, I have tried the script below to accomplish this, but it's not working as I hoped. <script type="text/javascript"> function getEventLogUserSelect(){ if(dijit.byId('dynamiceventusergridCWUSER')){ var selctedItem = dijit.byId('dynamiceventusergridCWUSER').selection.getSelected(); if(selctedItem.length){ dojo.forEach(selctedItem, function(selectedItem){ if(selectedItem !== null){ dojo.forEach(dijit.byId('dynamiceventusergridCWUSER').store.getAttributes(selectedItem), function(attribute){ var value = dijit.byId('dynamiceventusergridCWUSER').store.getValues(selectedItem, attribute); if(attribute == "USERID"){ window.opener.SetValue(value); window.close(); } }); } }); //alert("grid row selected"); }else{ alert("grid row not selected"); } } if(gbshowgridFlag==false){ alert("grid not loaded"); } } function SetValue(val){ var txt = document.getElementById('CWPROCESSEVENTLOG.USER_ID'); txt.value = val; } </script>
  10. Hello, im trying to make javascript/jquery code that will read excel file so i can paste it to listbox and make some functions.It should be like this DEMO 7, but with excel data and not php http://kotowicz.net/jquery-option-tree/demo/demo.html Here is one example also but mine needs more functionality not just writing all data to javascript, because i have 5000 lines in my excel file. http://www.mol.fi/paikat/
  11. http://jsbin.com/azipok/2/edit this piece of code does the trick of clearing up the option list of select menu and adding a "test" message, but this message becomes visible only upon dropping down the select menu. is there a way to make this "test" message display and replace the "no modules..." text upon clicking the button?
  12. Nice be with you everyone! Problem: Is there a function that will reset input date?_________________________________________________________________________________________________________ // Here's my code: <script type="JavaScript"> function reset() { // Is there a function that will reset input date?} <script> <input type="date" name="date"> <button onclick="reset()">Reset Date</button>_________________________________________________________________________________________________________ Thank you.
  13. Is there a Way with Javascript to add Help bubbles over an input Box?For example when you you hover over an input for Name: _____ it would say like First Name????ThanksAn example is this https://edit.europe.yahoo.com/registration?.intl=ukWhen you go over the name field it says First name in a bubble. Ive been searching all over and can not find out how to do it.
  14. Hello,I need your help on the following:I had a page that I want to make it password protected using Javascript which is fine, but I want to be able to change the password when I login to that page, is that possible? Thanks
  15. I have a jsp page(worklist.jsp) with button.. in button on click, am calling a function(getModify()), which is inside utility.js file.. after performing some actions in that function, am redirecting some values to next jsp page(modify.jsp) using winow.location.href.... in button on click, it has to call the function which i inside js file and open the page(modify.jsp) as popup window... how to get this... worklist.jsp page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><script src="script/Utility.js" data-dojo-config="parseOnLoad: true"></script></head><body><div dojotype="dijit.MenuBarItem" id="SearchMenu21" onclick="getModify();" style="font-size:11pt;" title="menuBarItem"> <img class="images" id="SearchMenu21" name="search5.png" onclick="setImgProperty(this.id)" src="images/uploads/search.png" style="height:20px; width:20px;"> Modify</div></body></html> utility.js page: function getModify(){var whereCondn = "";//alert(gbshowgridFlag);if(dijit.byId('dynamicgridCWPROCESS')){var selctedItem = dijit.byId('dynamicgridCWPROCESS').selection.getSelected(); if(selctedItem.length){ dojo.forEach(selctedItem, function(selectedItem){ if(selectedItem !== null){ dojo.forEach(dijit.byId('dynamicgridCWPROCESS').store.getAttributes(selectedItem), function(attribute){ var value = dijit.byId('dynamicgridCWPROCESS').store.getValues(selectedItem, attribute); //alert(value); if(attribute == "PROCESS_ID"){ whereCondn = whereCondn+attribute+"="+value; } //alert("new alert"+whereCondn); window.location.href = "modify.jsp?DETAIL="+whereCondn; }); } }); //alert("grid row selected"); }else{ alert("grid row not selected"); }} if(gbshowgridFlag==false){ alert("grid not loaded"); }}
  16. i have a javascript variable which holds date time value... i need only date from it... <script type="text/javascript"> function update(){ var datefield = document.getElementById("myTextBox_CWPWORKLIST.DUE_DATE").value; alert(datefield); } </script> here the datefield = 2013-02-21 00:00:00.0... i need datefield = 2013-02-21.. how to get this..
  17. Here is the problem. I'm trying to upload a file that contains a list of to be processed files, I then check the files using a perl script that runs an Rscript. I'm using those same files for subsequent processing. Everything is working fine on our site, but it gives a time out on someone elses site. The Rscript does not give feedback until it has finished running and starts processing. The results of the Rscript sends information back to the browser and to the php script. But in that time, the connection may already have been broken, giving a TCP time out error, especially for large data sets. I have the following files:index.php: form to upload a list of files and set some settingsparams.php: generates a unique folder, calls a perl (find.pl) script to generate the Rscript, the results from the Rscript are saved in the unique folder and are then used to call the processing script. After the Rscript has returned it's value, the browser will supply the settings page, which is needed to go the results page.find.pl: runs an Rscript to find information I need to keep the connection open so that the results can be send to the browser after the Rscript has finished running. I have used the following which I got from someone else with some modification, but this didn't work as the header('Location:') needs to come before anything else, but I first need to generate a unique userID that can be used to generate the unique folder, so it still keeps hanging. extra line in params.php header("Location:Load_array_type.php?folder=$userid"); // If I don't use different file to keep connection open Please wait! <?php// Add this code into you html page which the message " Pleasse wait while reading array types ! "// This html page is called after the user press submit (providing text file with cel files and starting R script)// These are additions that I had to make$userid=$_GET['folder']; #date['U'] // date['U']: I originally generated the unique userID here, but that meant that it would be regenerated everytime this page loaded, and this would mean that I would never get a message that said the Rscript finished running$project_name = $_POST['project_name'];$readfile=file("../master_files/configuration.conf");$path;for ($k=0; $k<=count($readfile)-1; $k++){ $fields = split("\t",$readfile[$k]); if ($fields[0]=="PATH"){ $path = $fields[1]; $path = str_replace(PHP_EOL,null,$path); }}$folder = $path."scratch/$userid/";$inputfolder = $path."scratch/$userid/input/"; // Set variables$statusRefresh = 5000; // set time for Auto-reload in milliseconds$arrayTypes = "path/filename_arrayTypes"; // file name, in which R script writes the array types (file must be finished, if you write cel by cel, then you need a small text file, which is saved when finished.) This needs the unique userID generated by params.php$thisPage = "Load_array_type.php?folder=$userid"; // name of the wait page $nextPage = "params.php"; // relative path and name of page with settings // Check if file with array types is saved$isFinished = file_exists($arrayTypes); echo "<form name='form1' enctype='multipart/form-data' method='post' action='$thisPage'></form>"; // Auto-reload while runningif ($isFinished) { // If finisched go to settings header("Location: $nextPage"); exit();}else { // If not finisched reload page in x seconds (as specified above) echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var t = setTimeout('document.form1.submit();',$statusRefresh);\n"; // Change 'form1' to your name of the form echo "</script>\n";}?> I have also tried the following javascript, but this goes to a blank page, and doesn't open the settings page which I need to get to the results page. JAVASCRIPT:function keepMeAlive(imgName) { myImg = document.getElementById(imgName); if (myImg) myImg.src = myImg.src.replace(/\?.*$/, '?' + Math.random());}window.setInterval("keepMeAlive('keepAliveIMG')", 100000);HTML:echo "<script type="text/javascript" src="javascript.js"></script>";echo "<img id='keepAliveIMG' width='1' height='1' src='../master_files/Picture1.png?' />"; Thanks for your help.
  18. General Question: Though aware that jQuery is just an adapted form of Javascript, I am confused about their simultaneous use and interaction. Although it seems very probable that one can employ jQuery wherever one employs Javascript, can one employ Javascript wherever there is jQuery. In my previous example entitled Turning the jQuery Overlay Tool Target Property into an Array I am wondering whether I could just as easily create my envisioned target property array inside the JQuery code as outside. For example, would it make a difference if I wrote, <script>$(window).load(function() { var overlay_target = Array('#overlay_1', '#overlay_2', ,,,, '#overlay_N); $("img[rel]").overlay({ effect:"apple" }); $("em.EM_Overlay").overlay({ effect:"apple", target:"overlay_target[]" });});</script> or <script>var overlay_target = Array('#overlay_1', '#overlay_2', ,,,, '#overlay_N);$(window).load(function() { $("img[rel]").overlay({ effect:"apple" }); $("em.EM_Overlay").overlay({ effect:"apple", target:"overlay_target[]" });});</script> Roddy
  19. I have made three "boxes" and each box contains a button. When I click the button, box hiding, when click again, box appears. This is my html code: <div id="SC1_A_"> <!-- BOX --> <div id="SC1_B_" onClick="SC1();" class="something"> </div> <!-- BUTTON --> </div> <div id="SC2_A_"> <div id="SC2_B_" onClick="SC2();" class="something"> </div> </div> <div id="SC3_A_"> <div id="SC3_B_" onClick="SC3();" class="something"> </div> </div> This is my javascript code: <script type="text/javascript"> function SC1(){ var SC1_A = document.getElementById('SC1_A_); var SC1_B = document.getElementById('SC1_B_); if (SC1_A.style.display == 'block' || SC1_A.style.display == ''){ SC1_A.className = 'something'; SC1_B.className = 'something else';} else {SC1_A.className = 'something else'; SC1_B.className = 'something';} } } </script> The example above works, but I have to make three similar scripts for each button. So I though to make something like this script below, using for loop. As you can imagine it didn't work. Any idea how can I make it work??? Thank you in advance!!! <script type="text/javascript"> for (i=1; i<10; i++){ function SCi(){ var SCi_A = document.getElementById('SC'+i+'_A_'); var SCi_B = document.getElementById('SC'+i+'_B_'); if (SCi_A.style.display == 'block' || SCi_A.style.display == ''){ SCi_A.className = 'something'; SCi_B.className = 'something else';} else {SCi_A.className = 'something else'; SCi_B.className = 'something';} } } </script>
  20. Hey Everyone! i want to convert my HTML form data to JSON and send that JSON to a PHP page on server. How can i do that. My HTML form is like this.. <!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></head><body id="top"><p>Enter Products</p><form id="form1" name="form1" method="post" action="create_product.php"> <p>Name <input type="text" name="name" id="name" /> </p> <p>Description <input type="text" name="desc" id="desc" /> </p> <p>Short Description <input type="text" name="short_desc" id="short_desc" /> </p> <p>Weight <input type="text" name="weight" id="weight" /> </p> <p>Price <input type="text" name="price" id="price" /> </p> <p>SKU <input type="text" name="sku" id="sku" /> </p> <p>Category <select id="userdata" name="category"> <option>Choose</option> </select> </p> <p>Promotion <select name="promotion"> <option value="1">Yes</option> <option value="0">No</option> </select></p> <p> <br> <label for="image"><span class="style1">Enter Image</span></label><br> <input type="file" name="uploaded" id="uploaded" /> </br></br> </p> <p>Submit <input type="submit" name="button" id="button" value="Submit" /> </p></form><p>*SKU must be unique</p></body></html> Please help me..
  21. I was looking through one of my web dev books when I found a javascript function I just didn't get. it was used in a cookie that stored info about radio buttons chosen. the function is escape() and here is the line document.cookie="optFont=" +escape(fontChoice)+";expires="+expire.toUTCString(); can anyone tell me what this function does and some common uses
  22. Morning to you Master of Java Programming. My name is King Amada, with basic knowledge of HTML and Javascript. I want to Create a javascript button, that onclick it will open itunes and play music, i am using Mac OSX 10.8.2, and have safari browser to test my website. and i want to validate my form, i want the user not be able to submit the form without filling in all the fields, and selecting the platform, and last but not least, i want if the user select wimac, to open another music file, if wimob to open another one, please help me out. this is my code below, help me out please? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""]http://www.w3.org/TR...nsitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Untitled Document</title><style type="text/css">#apDiv1 {position: absolute;width: 200px;height: 331px;z-index: 1;left: 189px;top: 121px;font-style: oblique;font-weight: lighter;color: #999;background-image: url(../../Downloads/back_to_the_mac.jpg.png);}#apDiv2 {position: absolute;width: 200px;height: 56px;z-index: 2;font-size: 18px;left: 0px;top: 82px;}</style><script type="text/javascript">function MM_validateForm() { //v4.0 if (document.getElementById){ var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == '');} }</script></head><body background="../../Downloads/back_to_the_mac.jpg.png"><div id="apDiv1"> <table width="200" height="331" border="0"> <form id="form1" name="form1" method="get" action="../../Movies/Music Videos/Michael Jackson - Dirty Diana - YouTube.FLV"> <tr> <th width="107" scope="col" align="left">WiName:</th> <th width="77" scope="col"> <label for="WName"></label> <input type="text" name="WName" id="WName" tabindex="1" size="15"/> </th> </tr> <tr> <th scope="row" align="left">WiKey:</th> <td><label for="Wkey"></label> <input type="Password" name="Wkey" id="Wkey" tabindex="2" size="15" /></td> </tr> <tr> <th scope="row"> </th> <td><div id="apDiv2" align="center"><hr />Platform<hr /></div></td> </tr> <tr> <th scope="row" align="left">WiMob:</th> <td><input type="radio" name="radio" id="Mob" value="Mob" tabindex="3" /> <label for="Mob"></label></td> </tr> <tr> <th scope="row" align="left">WiWin:</th> <td><input type="radio" name="radio" id="Win" value="Win" tabindex="4" /> <label for="Win"></label></td> </tr> <tr> <th scope="row" align="left">WiMac:</th> <td><input type="radio" name="radio" id="Mac" value="Mac" tabindex="5" /> <label for="Mac"></label></td> </tr> <tr> <th scope="row"> </th> <td><input name="Submit" type="submit" id="Submit" tabindex="6" onclick="MM_validateForm('WName','','R','Wkey','','R');return document.MM_returnValue" value="Submit" /></td> </tr> </form> </table></div></body></html> Read more: http://forum.codecall.net/topic/73719-javascript-programming-to-play-open-and-play-itunes-music-in-itunes/#ixzz2GZDwc46I
  23. My website is runing on WP Platform running PHP and MYSQL. I'm trying to buid a simple search form that will work as follow: The search form will have 5 fields as follow: Select a StateSelect a CountySelect a CitySelect a CompanyAgent Type If a user click and select the State the form will automatically select all counties within that state, then the third field will auto select every city when the user select the county and so fourth. When the user is done and is ready to hit submit the form will manually redirect the user to that specific page he or she selcted. Here is the code that I have so far: SEARCH: <form role="search" method="post" id="searchform" action="#" > <input type="hidden" value="" name="s" /> <input type="hidden" value="listing" name="post_type" /> <select name='State' id='State' class='state'> <option value="Select a State" selected>Select a State</option> <option value="AL" >Alabama</option> <option value="AK" >Alaska</option> <option value="AZ" >Arizona</option> <option value="AR" >Arkansas</option> <option value="CA" >California</option> <option value="CO" >Colorado</option> <option value="CT" >Connecticut</option> <option value="DE" >Delaware</option> <option value="FL" >Florida</option> <option value="GA" >Georgia</option> <option value="HI" >Hawaii</option> <option value="ID" >Idaho</option> <option value="IL" >Illinois</option> <option value="IN" >Indiana</option> <option value="IA" >Iowa</option> <option value="KS" >Kansas</option> <option value="KY" >Kentucky</option> <option value="LA" >Louisiana</option> <option value="ME" >Maine</option> <option value="MD" >Maryland</option> <option value="MA" >Massachusetts</option> <option value="MI" >Michigan</option> <option value="MN" >Minnesota</option> <option value="MS" >Mississippi</option> <option value="MO" >Missouri</option> <option value="MT" >Montana</option> <option value="NE" >Nebraska</option> <option value="NV" >Nevada</option> <option value="NH" >New Hampshire</option> <option value="NJ" >New Jersey</option> <option value="NM" >New Mexico</option> <option value="NY" >New York</option> <option value="NC" >North Carolina</option> <option value="ND" >North Dakota</option> <option value="OH" >Ohio</option> <option value="OK" >Oklahoma</option> <option value="OR" >Oregon</option> <option value="PA" >Pennsylvania</option> <option value="RI" >Rhode Island</option> <option value="SC" >South Carolina</option> <option value="SD" >South Dakota</option> <option value="TN" >Tennessee</option> <option value="TX" >Texas</option> <option value="UT" >Utah</option> <option value="VT" >Vermont</option> <option value="VA" >Virginia</option> <option value="WA" >Washington</option> <option value="WV" >West Virginia</option> <option value="WI" >Wisconsin</option> <option value="WY" >Wyoming</option></select><select name='county' id='county' class='county'> <option value="Select a County">Select a County</option></select><select name='city' id='city' class='city'> <option value="Select a City">Select a City</option></select><select name='company' id='company' class='company'> <option value="Select a Company">Select a Company</option></select><select name='agent type' id='agent type' class='agent type'> <option value="Agents Type">Agents Type</option></select><input type="submit" id="searchsubmit" class="searchsubmit" value="Submit" /></form> Thank you so much for all your help!
  24. I want to change something in a table when i click on it,so i create a onclick function,but i notice if i have a fucntion like this: <html><head><script type="text/javascript">function handleRightClick(){document.getElementById("test").innerHTML="123123";}</script</head><body><table id="test" oncontextmenu="handleRightClick(this); return false;"><tr><td>A</td></tr><tr><td>B</td></tr><tr><td>C</td></tr></body></html> when i click on it, it will change everything,how can i change all my elements sperate ?like when i click on A, only a will change. I want to know how to make it in one function,not create a new functionbecause if i have 50 elements then i may need to have 50 same functions to do it lol Many thanks
  25. I am currently working on a minesweeper game function about calculate adjacent mines,i have done the fully code now, but i might some error inside itso when i open up the page, there's no number came out.My target is when i open up a browser and there will be ten mines withnumber around it can someone tell me what i should correct? this is the code to lay 10 random mines,it working good: Code: function addmines () { var mine = 9; var mineNumber = 0; var n = 10; //number of mines while (n>0) { var row = Math.floor(Math.random()*9); var col = Math.floor(Math.random()*9); var id = "r" + row + "c" + col; var td = document.getElementById(id); if (td.children.length > 0) continue; //there's already a mine here n--; var a = document.createElement("img"); a.src = "mine32.gif"; a.height = 30; a.width = 30; a.id = 'mine' + mineNumber; td.appendChild(a); mineNumber++; }} The code below is the main problemi had made a little function to test if the loop works or not,and i can see it is working but there is still no number appear. Code: function neighbours () { var dr = [-1, -1, 0, 1, 1, 1, 0, -1]; var dc = [ 0, 1, 1, 1, 0, -1, -1, -1]; var newRow = 9; var newCol = 9; for (var row=0; row<newRow; row++) { //a nested for loop that reiterates 9 times creating the <td>'s and then exits to the parent for loop. for (var col=0; col<newCol; col++) { //document.getElementById('r1c1').innerHTML = '<span class="label4">4</span>'; var id = 'r' + row + 'c' + col; //document.getElementById(id).innerHTML = '<span class="label4">4</span>'; if (addmines.toString().indexOf(id) == -1) { var counter = 0; //looping over for (var i=0; i<dr.length; i++) { /* //CODE GIVES MEGA ISSUES if(row+dr[i]>0 && col+dc[i]>0 && row+dr[i]<=newRow && col+dc[i]<=newCol) { //document.getElementById(id).innerHTML = '<span class="label4">4</span>'; DOES NOT WORK IN HERE var id = 'r' + (row+dr[i]) + 'c' + (col+dc[i]); if (mines.toString().indexOf(id) != -1) { counter++; } //END IF } //END IF //END OF PROBLEM CODE */ document.getElementById(id).innerHTML = '<span class="label4">4</span>'; //WORKS IF PROBLEM AREA IS DISABLED var id = 'r' + r + 'c' + c; var obj = document.getElementById(id); obj.firstChild.nodeValue = count; //value obj.className += ' m' + count; //style } //END FOR } //END IF } //END FOR }} function insertText () {
×
×
  • Create New...