Jump to content

Search the Community

Showing results for tags 'javascript'.

  • 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

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. I have developed a simple html page. In that page there is a html button. If any user browses the page with Edge Browser then a message will show to click on that button to visit the page in Internet Explorer. To open Internet Explorer I have Used ActiveXObject. But the button is not working to launch Internet Explorer in Edge Browser. The code is given bellow. function LaunchIE() {var obj = new ActiveXObject("WScript.Shell");var ie = "C:Program FilesInternet Exploreriexplore.exe";obj.Run('"' + ie + '"', 1);} Can anyone please give me suggestion.
  2. im trying to output a json file to an expandable tree using html and jquery. its working, but the nesting and nodes within the tree are misplaced. any idea what that is? for example. mainstation 2 is coming out as a child of mainstation 1, while they should be siblings. it should be a logic error html code:<!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $.ajax({ url: "converted39.json", dataType: 'json', success: function(tree) { traverse($('#treeView'), tree) $('#treeView li:has(li)').addClass("Max").click(function(e) { $(this).toggleClass("Max Min"); $(this).children("ul").toggle(); e.stopPropagation(); }) $("[href]").addClass("Blue").click(function(e){ $(this).toggleClass("Purple"); e.stopPropagation(); window.location.href = $(this).attr("href") }) $('#treeView li').click(function(g) { var mytree2 = $(this); mytree2.children('li').toggle(); g.stopPropagation(); }) } }) }); function traverse(node, o) { for (var i in o) { if(i == "__text" || i == "_href" ) continue; if (o !== null && typeof(o)=="object") { if(o.__text){ var ul = $("<ul>").appendTo(node) var node=$('<li>').appendTo(ul) if(o._href){ var n = $("<span>").appendTo(node) $(n).text(o.__text).attr("href", o._href) } else{ $(node).text(o.__text) } } } traverse(node,o); } else{ var ul = $("<ul>").appendTo(node) if(o.__text){ var li = $('<li>' + o._text + '</li>').appendTo(ul) if(o._href){ var n = $("<span>").appendTo(node) $(n).text(o.__text).attr("href", o._href) } }else{ $('<li>' + o + '</li>').appendTo(ul) } } } } </script> JSON CODE:{ "MAIN": { "MainStation": [ { "Substation": [ { "Control": "Control1n", "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control2" }, "PushButton": { "__text": "PushButton1", "_attr": "successnDatffffffffffffffffffffffffffffffffffffffffffffffffffffffffe:17july" }, "_href": "http://google.com", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1", "_attr": "Control1 woohoo" }, "Control": "Control2", "PushButton": "PushButton1", "__text": " Substation2nnnnnnn" }, { "Control": [ "Control1", "Control2", "Control3", "Control4" ], "__text": " Substation3nnnnnnnnn" }, { "PushButton": [ "PushButton1", "PushButton2" ], "__text": " Substation4nnnnn" } ], "__text": " Mainstation1nnnnnnnnn" }, { "Substation": [ { "Control": [ "Control1", "Control2" ], "PushButton": "PushButton1", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1" }, "Control": "Control2", "PushButtonExpandable": { "MiniPushButton": [ "MiniPushButton1", "MiniPushButton2" ], "__text": "PushButton1" }, "__text": " Substation2nnnnnnn" } ], "__text": " Mainstation2nnnnn" } ], "ElectricStation": { "Substation": [ { "Control": [ "Control1", "Control2" ], "PushButton": "PushButton1", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1" }, "Control": "Control2", "PushButtonExpandable": { "MiniPushButton": [ "MiniPushButton1", "MiniPushButton2" ], "__text": "PushButton1" }, "__text": " Substation2nnnnnnn" } ], "__text": " ElectricStation1nnnnn" }, "__text": " MAINnnnnnnn" }}
  3. Dear friends, Basic need -------------- I need to call asmx webservice from javascript function. onbuttonclick, i am actually calling that javascript function. line with high size font is the problem area. please help guys working from past 5 days on this part WebService Registration with aspx page--------------------------------------------------- <form id="form1" runat="server"> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true"> <Services> <asp:ServiceReference Path="~/dataPreExist.asmx"/> </Services> </asp:ToolkitScriptManager> WEBSERVICE ------------------ <ToolboxItem(False)> _ Public Class dataPreExist Inherits System.Web.Services.WebService <WebMethod()> _ Public Function EnqPreExistOrNot(ByVal paraCcn As String, ByVal paraPcode As String) As Boolean Dim strsql6 As New StringBuilder Dim localdt6 As New DataTable ' ccn = "DJ079" ' party = "04BSPT0066" With strsql6 .Append("select * from complaintmastercrm where ccncd='" & paraCcn & "' and partycd='" & paraPcode & "'") End With localdt6 = CommonDb.ReturnDataTable(strsql6.ToString, "CRM") If localdt6.Rows.Count > 0 Then EnqPreExistOrNot = True MsgBox("pre Enquiry Exist") MsgBox("Pre Enquiry not exist") Else EnqPreExistOrNot = False End If End Function End Class End Namespace Javascript Function ------------------------- function webServiceCall() { var paraCcn; //var paraPartyCd; var paraPcode; //alert('hello last') paraCcn = document.getElementById("<%=lblCcn.clientID%>").innerHTML; paraPcode = document.getElementById("<%=hdnParty.clientID%>").value; paraPcode = paraPcode.replace(/,s*$/, ""); var a = new namespace1.dataPreExist(); //not working block a.EnqPreExistOrNot(paraCcn, paraPcode, OnSucessorFail); //not working block } function OnSucessorFail() { debugger; var proceed; proceed = confirm("Enquiry already Generated for this Machine and Cost Center"); if (proceed == true) { return true; } else { return false; } }
  4. First of all, sorry if this is an inappropriate place to post this thread but I don't really know a better place to post it. This isn't any full time job, more of a partnership. I'm sure for a skilled programmer this would be rather easy.. But I am not one, which is why I'm looking for help.I want someone who can program games, such as a coin flipping game, slot machine game and games like blackjack (although, I have a coin flipping and slot machine game coded, just not by me) and integrate them with the Steam/CS:GO API, allowing users to log in, send CS:GO skins/knives (which can be very valuable) to a bot and then play these games for the chance of winning a lot more skins/knives.If you aren't fully accustomed to the Steam/CS:GO API then there are official Steam API guides. I have a couple more things I would like added which I will discuss if you contact me.Email: csgoroulettebusiness@gmail.comPay: All profits 50/50, a payment at the end could be arranged but I am spending a lot of money on other things important for the website (advertising although it's rather low-key, domains since I'm thinking about switching to a different one, creating a stockpile of skins/knives so that I can actually have the games functioning and not have people spending skins on games with no chance of winning anything and there's more I need to pay for but I hope you understand I'm not just BSing or something). Some of the more popular websites out there already make a lot of money from doing this, so if we improve upon what they've done, add more features, games etc and add a better monetary system, then the pay should be quite a lot, that is if all games/elements are implemented.Why bother helping?: First of all, the domain is already paid for, but like I said, I might buy a new off someone who's selling it. Quite a lot of the website is finished but there's still quite a bit more to do. You get to sleep soundly tonight knowing that you've helped a fellow programmer create something he loves. And, well, all you have to do is do some programming and sit back and watch the money roll in. Might sound too good to be true and although there's quite a bit of programming involved, it really is as simple as that. The websites out there are either basic, scams or just very poor and I hope to change that. I have plenty of new and fresh ideas which would entice a lot of CS:GO gamers and possibly even streamers to my website. I also have a different way for the site to earn money which greatly benefits both the creators and the users.Thanks for reading,Joe
  5. Hello, How can test website load traffic, more explain(how many number of users enter at the same time in website) without website down very thanks.
  6. leandre

    Introduction

    Hi All, I am new to the forum my name is Leandre if it does not appear already . Is this a place where one can ask and answer to questions? Thanks
  7. Having a hard time getting the CSS and Javascript files referred to, how the work together into my head. When naming text files of html, and having it in a folder along with css and javascript. It seems like when building a site with the (great) web building tutorial that I like so much. I can vary a few attributes and things like that. It seems like every time I set it up with anything other than "demoweb" "index dot html" title of "our company" as instructed I get dodgy results. I also seem to have hit and miss PHP results. I am still plugin away at this if someone knows what I mean I would appreciate it. to put the question another way: 1 how many words in the naming of the files in site folders can you have? and 2. Does the name of the file dictate weather the css is recalled or linked?, 3. if is there a way to have multiple scripting and css sheets named in the folder? here is where I am studying from lately- Web Building
  8. I've been making tons of progress on my vehicle fit guide. I've made a drop down box dynamically populate based on previous selections, and now I need those selections to search the xml file and return my results. My old code only searched by the vehicle year, and that returned all vehicles with the same year. I'm trying to parse my XML using multiple variables, and now can't get any results to return. how am I able to search for models, then search for years within the model? here are my code snippets below, which currently only search the whole XML file for similar years: <!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="xmlcss.css"><script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script><script type="text/javascript">jQuery(document).ready(function($){ var $xml; var make = $('#make'); var model = $('#model'); var year = $('#year'); var front1 = $('#Front_Location_1'); var frontsize1 = $('#Front_Size_1'); $.get('fitguide3.xml', function(data){ $xml = $(data); var rows = $(data).find('ROWSET ROW'); var makes = []; $.each(rows, function(index, element){ var _make = $(element).find('MAKE').text(); makes.push('<option value="' + _make + '">' + _make + '</option>'); }); makes = $.unique(makes); make.append(makes.join('n')); }, 'xml'); $('#make').on('change', function(){ var _value1 = $(this).val(); var _models = $xml.find('ROWSET ROW:contains("'+_value1+'")'); var models = []; console.log(_models); $.each(_models, function(index, element){ var _model = $(element).find('Model').text(); models.push('<option value="' + _model + '">' + _model + '</option>'); }); models = $.unique(models); model.find('option').remove(); model.append(models.join('n')); }); $('#model').on('change', function(){ var _value2 = $(this).val(); var _years = $xml.find('ROWSET ROW:contains("'+_value2+'")'); var years = []; console.log(_years); $.each(_years, function(index, element){ var _year = $(element).find('YEAR').text(); years.push('<option value="' + _year + '">' + _year + '</option>'); }); years = $.unique(years); year.find('option').remove(); year.append(years.join('n')); }); // $('#make').val() // $('#model').val() // $('#year').val() $('#year').on('click', function(){ var _value3 = $(this).val(); var finalmodel = $('#model').val(); var _front1 = $xml.find('ROWSET ROW:contains("'+_value3+'")'); console.log(_front1); <!-- $("#Front_Location_1").html(""); --> $.each(_front1, function(index, element){ var _front = $('#frontspeakers').val(); var front = []; front.push('<p>' + element + '</p>'); front = $.unique(front); front1.append(element); }); })});</script></head><body><p id="test"></p><select id="make"><option value='0'>---Select Make---</option></select><select id="model" name="model"></select><select id="year"></select><table style="width:100%"><tr><td>Front Location 1</td></tr><tr><td id="frontspeakers"></td></tr><tr><td id="Front_Location_1"></td></tr></table> And this is how my XML file is set up: <?xml version="1.0"?><ROWSET><ROW><MAKE>ACURA</MAKE><Model>CL</Model><YEAR>2001-2003</YEAR><Front_Location_1>Door</Front_Location_1><Front_Size_1>6 1/2</Front_Size_1><Front_Location_2>Sail Panel</Front_Location_2><Front_Size_2>1 </Front_Size_2><Rear_Location_1>Deck</Rear_Location_1><Rear_Size_1>6 x 9</Rear_Size_1><Rear_Location_2></Rear_Location_2><Rear_Size_2></Rear_Size_2><Other_Speakers></Other_Speakers></ROW><ROW><MAKE>ACURA</MAKE><Model>CL</Model><YEAR>1999-1999</YEAR><Front_Location_1>Door</Front_Location_1><Front_Size_1>6 1/2</Front_Size_1><Front_Location_2>Sail Panel</Front_Location_2><Front_Size_2>1 </Front_Size_2><Rear_Location_1>Deck</Rear_Location_1><Rear_Size_1>6 x 9</Rear_Size_1><Rear_Location_2></Rear_Location_2><Rear_Size_2></Rear_Size_2><Other_Speakers></Other_Speakers></ROW> This searches for them, but returns every model with the same years. Work-in-progress version located HERE Any help would be great!
  9. Let me just say sorry for the very poor title. It isn't bait or anything, please read on. And please leave out any 'you sound unqualified' comments, I come here merely asking for your most gracious helpHello there. I'm currently in the process of creating my own CS:GO betting/gambling website but I am currently really stuck and I need your help!I am very new to Javascript and have tried to learn it through videos, websites, tutorials etc etc but I honestly don't really know what I need to know or how to properly implement it. SummaryThere's a gaming distribution site called Steam. On Steam is a competitive, FPS game called Counter Strike: Global Offensive. On there you can win/buy/unlock/trade skins and knives, which can be incredibly valuable. There are quite a few sites out there already such as: https://csgojackpot.com/ andhttps://skinarena.com/ however, in my opinion, they are rather poor and basic and I have many ideas on how to improve on their work (many CS:GO websites copy heavily off of each other, is this how so many people have managed to make their own websites?)When on one of these websites, you log in using your Steam account name and password. Once logged in, you need to post your trade link. This trade link is used for when you want to deposit any skins to the pot and for if you win. When you click deposit, a bot sends you a trade link. You add the skins/knives and send them to the bot. Your deposit is then added to the pot with many others. Once a certain number of people have deposited, a winner is chosen (the more valuable your skins/knives are, the higher chance of winning) and hash is made. The winner is sent a trade request and is given the skins/knives they have won.So my question is, where can I learn how to do this?! What do I need to learn? I am not asking for somebody to come along and say "Oh, you need this which I have just made for you, and this which my friend made and then bam, it'll work", I am asking somebody to kindly make a list of what I need to learn exactly and not just "Yeah, erm, you should learn Javascript moron" because I have tried to learn Javascript already but I still have no clue how to go about this.. Like, how do I create a CS:GO Steam bot? (This isn't much to do with JS, but more Virtual Studio I think). How would I get that bot to communicate with the website? How can I tell the bot that "here is the trade link, send a trade offer to this link!"? How do I create a hash along with the winner? Do I have to use a crawler to gain the prices of the skins/knives?I have many questions such as how to the website/server fetch the user's profile name (different to their account name) and avatar/picture.Sorry for the very long amount of text. I am not asking for a definitive answer as such, just for somebody who is experienced to just calm me down and tell me what I need to know since I don't know exactly what I need to know.. And again, please so no "you sound too bad to be creating websites like this" which is true, I suppose , but I feel that my website would really change things and gain a lot of popularity. Side note: Would buying a £25 book definitely go through this kind of stuff? Or is JS quite large and it's rather unlikely? Please, excuse my extreme ignorance and stupidity :'(
  10. I used AJAX to retrieve concatenated data from a XML document. Now I need to store that data into a Javascript array. How do I do this? My Javascript Code: var SVG_Data var Retrieved_Data var Coordinate_Pair var Element_List var Counter function Setup() { SVG_Data = new XMLHttpRequest(); SVG_Data.open("GET","http://localhost:8080/exist/rest/db/apps/HTML_Student/Database_Retrieval.xq", true); SVG_Data.onreadystatechange = function () { if (SVG_Data.readyState = 4) { Retrieved_Data = SVG_Data.responseText; document.getElementById("Information").value = Retrieved_Data; Coordinate_Pair = new Array(); Coordinate_Pair.push.apply(Retrieved_Data); Element_List = new Array("Top_Ladder_Line","Middle_Ladder_Line", "Bottom_Ladder_Line"); for (Counter = 0; Counter < 3; Counter++) { document.getElementById("Information").value = Coordinate_Pair[Counter]; document.getElementById(Element_List[Counter]).setAttribute("points", Coordinate_Pair[Counter]);} } } SVG_Data.send(); } The concatenated data I received from the eXist database: "60,30 60,80 150,80 150,30", "60,130 60,80 150,80 150,130", "60,180 60,130 150,130 150,180"
  11. Please look at the code: in this line: line#42reactionTime = (clickedTime - startTime)/1000; all browsers are saying that startTime is not defined :/ any help will be appreciated <!doctype html><html><head> <title>Learning JavaScript</title> <meta charset="utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style type = "text/css"> #simpleBox{ width:200px; height:200px; background-color:red; display:none; } </style></head><body> <div id = "simpleBox"></div> <script type = "text/javascript"> function makeBox() { var clickedTime; var startTime; var reactionTime; var x = Math.random(); x = x*5000; setTimeout(function (){ document.getElementById("simpleBox").style.display = "block"; startTime = Date.now(); }, x); } document.getElementById("simpleBox").onclick = function (){ clickedTime = Date.now(); reactionTime = (clickedTime - startTime)/1000; alert(reactionTime); this.style.display = "none"; makeBox(); } makeBox(); </script></body></html>
  12. hi , i try to write a function that provide to change the image when i click on it: <body> <script> function hide(){ if (document.getElementById("image").src == "arrowup.png"){ document.getElementById("image").src = "arrowdown.png"; } else { document.getElementById("image").src = "arrowup.png"; } } </script> <img id="image" onclick="hide()" src="arrowdown.png" width="30" height="30"/> </body> but it doesnt work , what is the problem, please????
  13. This is my Javascript code: var Data_Display var My_Data function Setup() { My_Data = new XMLHttpRequest(); My_Data.open("GET","http://localhost:8080/exist/rest/db/apps/HTML_Student/Database_Example.xq"); My_Data.send(); document.getElementById("Information").value = My_Data.responseXML; } This is my XML code: <xml> <svg> <svg_data>100</svg_data> </svg> </xml> This is my XQuery: xquery version "3.0"; for $Data in doc("Database_Example.xml")/xml/svg/svg_data where $Data = 100 return $Data When I ran the Javascript code, the computer gave me an Access Control Allow Origin error. It told me that I needed a CORS request. Since I have no idea what a CORS request is or how to insert it into my code, I'm stuck. Can anyone assist me?
  14. So I am learning JavaScript, and I come across this (which is one of the first things I learned about JS from your website, thank you). The first "method", if you call it that, which you show is the .innerHTML method to change the interior of an HTML element, given a named id. I have since learned other methods to be used with it, such as .value and .style. But I have never seen a comprehensive list of all the methods that can be used with this command. Either I'm not looking in the right place (which is entirely possible), or it's just not there. Since this is supposed to be a comprehensive website for all things related to web development, I think this would be a great addition to an already great website.
  15. If you view the jFiddle example in chrome, and view the Javascript console, you will see the frame rate output is constant and smooth. Then if you switch over to Firefox > Firebug console and run the jFiddle again, you will see it goes smooth except for every so often it pauses for a moment. I've literally been unsuccessful for over a year to get a smooth loop going in all browsers. I'm hoping someone can shed some light on whats going on with this small example! I appreciate everyone who reads this and takes a look a the problem..: http://jsfiddle.net/aLv3vsv8/
  16. This is a question I got asked in an interview. I know the array would just return zeros since this is asynchronous, but why does this happen, and how can you fix it so that the results array inserts the appropriate data? Question: Suppose findData is a function that takes a query object and returns a promise for the result of the query. Suppose also that someRandomArrayOfQueries is an array of query objects. Explain what would be printed by the following code and why: function runMultipleQueries(queries) { var results = []; queries.forEach(doQuery); return results; function doQuery(query) { findData(query) .then(results.push.bind(results)); } }function log(value) { console.log(value);}runMultipleQueries(someRandomArrayOfQueries).forEach(log);
  17. Hello I've been messing around with a small script i've put together from reading various different turorials about drag and drop. I just cannot get removeEventListener to work.. Basically you can begin dragging but the element is stuck on the mouse and you cannot drop it. I've been able to set a variable to toggle on and off to stop it from dragging but I want to understand how to use removeEventListener incase I need it in the future. I appreciate any help. I've posted all of the code at the following JS Fiddle, however for some reason the dragging won't work at all on JS Fiddle: (sorry I'm new to js fiddle) http://jsfiddle.net/7wpxa4tm/ That exact same code does work for me on all browsers back to IE9. It will begin dragging, and then the remove listener which is in the "ignore" method just will not work. Does anyone see any obvious reason for this? I've been messing with this for two days, I've read around a bunch and thought that I realized my problem when I found that you can't use anonymous functions as callbacks as I was previously doing, but even after setting my callbacks to variables it still won't work. Here is the code posted below if that is prefered: EDIT: Sorry the problem is located in D.drag.release() EDIT 2: JFiddle is now loading, had the onload setting wrong, now you can see the problem with the remove listener http://jsfiddle.net/7wpxa4tm/6/ var DragElement = function() {var D = this;this.elem = null;this.offsetX = 0;this.offsetY = 0; this.init = function() { D.anch = document.getElementById('drag-anchor'); D.elem = document.getElementById('wig'); console.log('D.init()'); var call_back = function(event) { console.log('mousedown'); D.drag.anchor(event); }; D.listen(D.anch, 'mousedown', call_back); } this.listen = function(elem, evt, handler) { if (elem.addEventListener) { elem.addEventListener(evt, handler, false); return true; } else if (elem.attachEvent) { return elem.attachEvent('on' + evt, handler); } else { evt = 'on'+evt; if(typeof elem[evt] === 'function'){ handler = (function(f1, f2){ return function(){ f1.apply(this, arguments); f2.apply(this, arguments); } })(elem[evt], handler); } elem[evt] = handler; return true; } return false; } this.ignore = function(elem, evt, handler) { if (elem.removeEventListener) { elem.removeEventListener (evt, handler, false); } if (elem.detachEvent) elem.detachEvent ('on'+evt, handler); } this.drag = { 'dragging' : false, 'release' : function(event) { //D.drag.dragging = false; I can use this dragging boolean to control if it drags or not..but I want to know how to use the remove listener /******** the following remove event method (ignore) will not work...*****/ var call_back = function(event) { D.drag.move(event); }; D.ignore(D.anch, 'mousemove', call_back); }, 'anchor' : function(event){ D.drag.dragging = (D.drag.dragging) ? false : true; D.offsetY = event.clientY-parseInt(D.elem.offsetTop); D.offsetX = event.clientX-parseInt(D.elem.offsetLeft); var call_back = function(event) { D.drag.move(event); }; D.listen(D.anch, 'mousemove', call_back); }, 'move' : function(event) { if(!D.drag.dragging) return; D.elem.style.position = 'absolute'; var top = (event.clientY-D.offsetY); var left = (event.clientX-D.offsetX); D.elem.style.top = top + 'px'; D.elem.style.left = left + 'px'; var call_back = function(event) { D.drag.release(event); }; D.listen(D.anch, 'mouseup', call_back); } }}var drag = new DragElement();drag.listen(window, 'load', function(event) { drag.init(event);}); EDIT 2: JFiddle is now loading, had the onload setting wrong, now you can see the problem with the remove listener http://jsfiddle.net/7wpxa4tm/6/ Edit 3: I just tried returning the removeEventListener function and outputting it to the console, it is "undefined" I guess the problem is how I am passing the function in, or saving the function, but I don't see a way to do it differently
  18. Hey guys. Can someone please explain For, While and Do While loop with an example? Thanks in advance
  19. I have already created mysql table with data, this is my javascript code <SCRIPT language="JavaScript">function send_status(){var status;var Digital=new Date()var hours=Digital.getHours()if (hours>=6&&hours<8) //on timestatus = "onTime";else if (hours>=8) //late comersstatus = "late";window.alert(status);}$.ajax({type: "POST",url: "ajaxjs.php",data: status,cache: false,success: function(html) {alert(html);}});}return false;}</SCRIPT> im attempting to generate a value for user status from th above if command in js then send this string into my db using ajax which is pointing to my php page <?php// Fetching Values From URL$connection = mysql_connect("localhost", "CJroot", ""); $db = mysql_select_db("mysql_practice", $connection); if (isset($_POST['typeahead'])) {$query = mysql_query("UPDATE user_signin SET status='$status' WHERE user_name = '$typeahead')"); //Insert Queryecho "Form Submitted succesfully";}mysql_close($connection); ?> im not getting it right please any suggestions?
  20. I am having a difficult time getting JavaScript to run in a Wordpress Post. I work extensively in forms, and creating calulators of different sorts. I want each script to be local for only one single post, not global. I know I can include the path in the header.php file, but with all the scripts I want to include in the Wordpress websites, I don’t want to convolute the header.php with lots of local file paths which are going to be one and done. I know Wordpress changes the html syntax when switching from text to visual, that is not my problem. The scripts I have written works in every editor I use, and with all the most popular browsers, but not when posted in Wordpress from the file.js path or when inserted with <script> tags. I can get very simple scripts with an alert() function, or document.write() function to work, but when I attempt form manipulation, no luck. When troubleshooting from a console, none of the variables or functions are acknowledged. All the websites I deal with are Wordpress. I'm frustrated because I want to really grow and expand my JavaScript skills, but I constantly hit dead ends with Wordpress and no one can offer guidance. I've been told to write everything in PHP. I am new to programming and want to learn JQuery and javaScript well before taking on any other language! Please Help!
  21. i was searching about it and tested and i get nothing progress, i have been not upload to server my project so i dont have any demo to show, but here is my issue https://github.com/rabmyself/smint/issues/21 i use jquery sminth yes everything is working and love itthe plugin, but i face problem about it when it in small device! here is setting for sminth $('.subMenu').smint({ 'scrollSpeed' : 1000 }); and i have try to remove with use this function $(window).on('resize', function(){ var win = $(this); if (win.width() < 514) { // alert('handphone'); $("nav").removeClass("subMenu"); //$('nav').attr('style',''); } }); yes the class removed but the navbar has css when i firebug so they all cannot remove all, i have logic that to remove but don't know to write in jquery even give me errors, here is my logic how can i do that in my jquery! $(window).on('resize', function(){var win = $(this); if (win.width() < 514) {//navbar without effect scroll } else{//navbar witheffect scroll}); Thanks
  22. I'm trying to block some sites through WebRequest, but when the checkbox this false even still blocking the site, anyone can help, this is the code that I have Options.js Background.js He had seen this example LocalStorage, but not how to use it... Can someone explain how to do to return the value...
  23. I am struggling with the JavaScript tutorial. Can someone please help me nail down the definition of a literal? The tutorial tells us "The JavaScript syntax defines two types of values: Fixed values and variable values." It then informs us that "...fixed values are called literals and variable values are called variables." I can memorize that, but I'm not sure what it means. Does this means that a variable called age has a literal value? For example, when I fill a form asking for my first name, assuming it is linked to a database variable called FirstName, Thomas would be a literal? What if the variable is age, would the number entered by a fixed variable or literal, even though that number will change in a few months? Is a variable value then the conceptual container that holds literals (and is a null value a literal)? So, is fair to say that a literal can be numbers (with or without decimals) or strings?
  24. I used a .js to avoid landscape view from mobile device. I edited a white full-screen image saying "this site is not thought to be viewed in landscape mode, please turn your device" to be shown each time I rotate my device from portrait to landscape. It works except when I load a page and I'm already in landscape mode. Any idea on how to fix it? Thanks <script>(function() {'use strict';var isMobile = {Android: function() {return navigator.userAgent.match(/Android/i);},BlackBerry: function() {return navigator.userAgent.match(/BlackBerry/i);},iOS: function() {return navigator.userAgent.match(/iPhone|iPad|iPod/i);},Opera: function() {return navigator.userAgent.match(/Opera Mini/i);},Windows: function() {return navigator.userAgent.match(/IEMobile/i);},any: function() {return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());}};if (isMobile.any()) {doOnOrientationChange();window.addEventListener('resize', doOnOrientationChange, 'false');}function doOnOrientationChange() {var a = document.getElementById('alert');var b = document.body;var w = b.offsetWidth;var h = b.offsetHeight;(w / h > 1) ? (a.className = 'show', b.className = 'full-body') : (a.className = 'hide', b.className = '');}})();</script> Update : I tried adding window.orientation to the script but something is wrong if (orientation === "landscape-primary") {doOnOrientationChange();window.addEventListener('resize',doOnOrientationChange,'false');}window.onload(doOnOrientationChange());
  25. Hello, I currently have a page id that is loading a random image on every page using JavaScript. I need to setup the JS file to load a specific image for a handful of specific pages. I'm a little stumped on how to call those pages and attach the background image for the id to it. Here is the code that I currently have for the random images: var imgCount = 17; var dir = '/images/random-headers/'; var randomCount = Math.round(Math.random() * (imgCount - 1)) + 1; var images = new Array images[1] = "top-header-001.jpg", images[2] = "top-header-002.jpg", images[3] = "top-header-003.jpg", images[4] = "top-header-004.jpg", images[5] = "top-header-005.jpg", images[6] = "top-header-006.jpg", images[7] = "top-header-007.jpg", images[8] = "top-header-008.jpg", images[9] = "top-header-009.jpg", images[10] = "top-header-010.jpg", images[11] = "top-header-011.jpg", images[12] = "top-header-012.jpg", images[13] = "top-header-013.jpg", images[14] = "top-header-014.jpg", images[15] = "top-header-015.jpg", images[16] = "top-header-016.jpg", images[17] = "top-header-017.jpg", document.getElementById("page-header").style.backgroundImage = "url(" + dir + images[randomCount] + ")"; A bit of a side note/help, I would also like to just have the random image called from the folder and not listed out, is this possible? Any and all help is greatly appreciated! Thanks in advance, mh
×
×
  • Create New...