Search Results

Search found 28881 results on 1156 pages for 'javascript is future'.

Page 42/1156 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Get Checked RadioButtons using JavaScript

    - by Rudi
    so I’m trying to build a win 8 app, which includes a WebView. The WebView contains the HTML code (+JavaScript) below. <!DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' > <script type='text/javascript'> function get_radio_value() { for (var i=0; i < document.myForm.frage1.length; i++) { if (document.orderform.frage1[i].checked) { var rad_val = document.myForm.frage1[i].value; return rad_val; } } } </script> <title>Kundenfragebogen</title> </head> <body> <h1>Kundenfragebogen</h1> <div id='myDiv'>Hello</div> <form name='myForm' action=''> <table border='2'> <tr> <td></td> <td>sehr gut</td> <td>gut</td> <td>schlecht</td> </tr> <tr> <td>Wie geht es Ihnen?</td> <td><input type='radio' name="frage1" value='1'/>Mir ging es noch nie besser!</td> <td><input type='radio' name="frage1" value='2'/>Es geht mir so wie immer.</td> <td><input type='radio' name="frage1" value='3'/>Heute geht einfach gar nichts…</td> </tr> <tr> <td>Können Sie Auto fahren?</td> <td><input type='radio' name="frage2" value='1'/>Ja</td> <td></td> <td><input type='radio' name="frage2" value='3'/>Nein</td> </tr> <tr> <td>Möchten Sie unseren Newsletter abonnieren?</td> <td><input type='radio' name="frage3" value='1'/>Ja</td> <td></td> <td></td> </tr> </table> <input type='button' value='Formular absenden' onclick="return get_radio_value()"/> </form> </body> </html> So the html contains some radio buttons and a button. I’ve used JavaScript ~2 years ago (just a little), so I don’t really know how to write the exact code. I’ve found something on the internet, but it doesn’t do what I want. I want to have the following: The user can check the RadioButtons. When the user clicks the Button, the JavaScript function should return all the checked radio buttons (I only need to know which RadioButton is checked). Since I know the name of the RadioButtons in my Windows 8 App, I can do the following: var object = WebView.InvokeScript("JavaScriptFunctionNAME", NameOfRadiobutton); So the WebView invokes the script and should get as a return the VALUE of the RadioButton, which is checked. “JavaScriptFunctionNAME” = name of the function in Javascript NameOfRadiobutton = the name of the RadioButton as a parameter (for example “frage1”). Currently I’m returning the value of the radiobutton, which is checked in the RadioGroup “frage1”. How can I check every RadioButton by it’s parameter? By this I mean I have a parameter “frage1” and return the value of the checked RadioButton. After this, I call the function again with the parameter “frage2” and return the checked RadioButtons value. Could anyone help me out with the JavaScript-function?

    Read the article

  • Does the jQuery .unbind() method only work on jQuery created events?

    - by Roberto Sebestyen
    I am trying to unbind all event handlers for all elements that are inside a particular container. Like a DIV. But those events have been bound/registered not using jQuery. Some are bound the manual way with onclick="...." or using regular native JavaScript. But when i do something like this $('#TheDivContainer').find('div,td,tr,tbody,table').unbind(); It does not appear to work. Which leads me to believe that the .unbind() only works if the events have been originally bound by jQuery. Is that true? Is there another way of unbinding all events from a group of elements ? Thanks!

    Read the article

  • Running Javascript in PHP

    - by Zero
    I'm loading an external .php file using: <script type="text/javascript" src="myfile.js.php"></script> Within the external myfile.js.php file, I'm using: <?php header('content-type: text/javascript'); $message = "Test message"; ?> document.write('<?php echo $message; ?>'); Everything works fine until I change the name of myfile.js.php to just myfile.php Why does it stop working if I remove the .js part from the file name? I'm serving the file as text/javascript, plus shouldn't the .js part be ignored since .php is the actual file extension? Does anyone know why? Thanks!

    Read the article

  • JavaScript to PHP

    - by Kemrop
    I am trying to send a variable from a Javascript to a php script but what gets sent is just the first string and the rest is discarded.Dont know what i would be doing wrong. Here is my code: <script type="text/javascript"> document.write('Historical Category 2 ') </script> My $_GET['category'] at the server side only prints Historical? Dont know what i may be missing or if there is a better way of passin data from a Javascript to PHP,i will appreciate.

    Read the article

  • Loading HTML5 video on iPad via onclick event tied to a div

    - by joncys
    I'm developing an HTML5 application (a game), that automatically preloads 5 video files. I'm able to do so correctly on Safari for PC, so there are no overlooked problems with file formats, codecs or such. The load fails on an iPad. As an official guide for video on iOS puts it: This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not. Does this mean, that I have no means to initiate the loading of video after a user initiated action, if that action hasn't been tied to a video element (user clicked on a regular div — I request loading and displaying of a video, compared to the user actually clicking on a video element to load and play that particular element)? Thanks for your help!

    Read the article

  • Simulate Click Javascript

    - by Belgin Fish
    Hi, I'm just wondering how I can have javascript simulate a click on a element. Currently I have <script type="text/javascript"> function simulateClick(control) { if (document.all) { control.click(); } else { var evObj = document.createEvent('MouseEvents'); evObj.initMouseEvent('click', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null ); control.dispatchEvent(evObj); } } </script> <a href="http://www.google.com" id="mytest1">test 1</a><br> <script type="text/javascript"> simulateClick(document.getElementById('mytest1')); </script> But it's not working :( Any ideas?

    Read the article

  • JavaScript pack("d") - binary strings

    - by Tim Whitlock
    I'm trying to replicate the Perl and PHP style pack and unpack functions in JavaScript. Unsigned integers were easy enough, so my pack('n') and pack('N') are ok. But my lack of a computer science background is a hurdle now and I don't know where to start with pack('d') for packing JavaScript's standard floating point. Is there a JavaScript library for this out there? If not, is there a good resource where I can learn how to do this? I am fine with bitwise and binary level operations in JS, I just don't know where to start with the logic. Thanks.

    Read the article

  • Simple Javascript question

    - by Rachel
    I have products : offer_id in javascript and am getting value of offer_id dynamically. Let say I get products : 12345 but now instead of that I want it to be as products : ;12345, than how can this be achieved in javascript. I have tried : products : ';'.offer_id products : ';'."offer_id" products : ';'.'offer_id' products : ";".offer_id But all of my above trials have failed and am getting syntax error for each one of those. I am newbie to Javascript and so would really appreciate any inputs.

    Read the article

  • The function client side is not working properly...

    - by jagdeep
    <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function abc() { return confirm('are U sure?'); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="abc()" onclick="Button1_Click" style="height: 26px" /> </div> </form> </body> </html> In the above page whether U click ok or cancel for confirmation box the processing transfer for server why?

    Read the article

  • Ruby methods within Javascript within HAML

    - by Josh
    I have a jQuery script that adds a new field to a form, and this field contains dynamic information from an array. The problem is that I can't figure out how to add an array.each to populate the options of the select field within the javascript without breaking the HAML indentation and causing errors. Here is my best attempt that does not work: %script(type="text/javascript") $('#mylink').click(function() { $('#mylink').after('<select> - myarray.each do |options| <option value="#{options.id}">#{options.name}</option> </select>); )}; Also tried it with the :javascript filter with no luck. EDIT: For whatever reason, I can't get the 4-space indents ( for Markdown ) working here, but I do have it indented properly.

    Read the article

  • need help revising this javascript that opens to a new window on submit/post

    - by Brad
    I have a form that once you select from a drop-down list and select submit, it is suppose to open up to a new window Here is the code that is currently on the page and I think it needs to be completely wiped out or revised, it only works in IE and Firefox <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> //<!-- Hide JavaScript from older browsers // Function to open a window function windowOpen(window_url) { helpWin = window.open(window_url,'','toolbar=yes,status=no,scrollbars=yes,menubar=yes,resizable=yes,directories=no,location=no,width=350,height=400'); if (document.images) { if (helpWin) helpWin.focus() } } // End script hiding --> </SCRIPT>

    Read the article

  • jsp in javascript

    - by Pavalesh
    hi I've created a jsp page. In that when i select 1 check-box or both check-box or none, the corresponding text-boxes and list-box must be displayed in the same page. For that i tried of calling a javascipt function when i click the checkbox. The javascript function contain code to display the textboxes. But it didn't work. Since I'm doing this project in struts, I don't know how to get check-box value. And calling of JavaScript function works. But didn't enter into jsp code in JavaScript function.

    Read the article

  • Add time to a Date object in javascript

    - by baiano
    I am trying to add time to a Date object in javascript but am not getting the results that I am expecting. I am trying to pull a timer off of the page and add it to the current time to get the unix timestamp value of when the timer will hit zero. The time on the page is displayed as " HH:MM:SS ". This is what I have: time=getTimerText.split(":"); seconds=(time[0]*3600+time[1]*60+time[2])*1000; to convert the time into milliseconds. fDate=new Date(); fDate.setTime(fDate.getTime()+seconds); add the milliseconds to the javascript timestamp alert(Math.round(fDate.getTime() / 1000)); convert the javascript timestamp to a unix timestamp Since the timer is counting down I should get the same result every time i run the script, but I don't. Can anyone see what I might be doing wrong here?

    Read the article

  • JavaScript eval() with `this`

    - by mojuba
    If I define a JavaScript code snippet in my HTML, like so: <div id=myElem onMyUpdate="alert('Update called for ' + this.id)">... then what is the most elegant way of evaluating it from within JavaScript with this properly assigned? What I came up with so far is something like this: if (elem.hasAttribute('onMyUpdate')) (function () { eval(elem.getAttribute('onMyUpdate')) }).call(elem); which looks terrible (to me), but works. Any better/more elegant alternatives? MDN says there used to be the second argument to eval() for doing just that but it's deprecated now; MDN then suggests to use operator with() instead, which, if you follow the link provided, turns out to be made deprecated by the latest standard. Dead end, in other words. (As a side note, StackOverflow ignores the word this in search terms and thus it may miss relevant answers - is there a way of telling it not to?) Edit: I forgot to mention: no jQuery please, just vanilla JavaScript

    Read the article

  • Javascript check all checkboxes in a table / asp.net

    - by SLC
    I have a table with rows in, and each row has a few <td> elements. The last element has a checkbox in. They are in a <div> which is set to runat="server". I have another checkbox on the page called "chkAll" that when clicked, I want to javascript check or uncheck all of the checkboxes in my table. I'm not very good at Javascript, so I am not sure what to do. I added a javascript onclick method, and put document.getelementbyid and put in the div.clientID, but I wasnt sure what to do from there. Any ideas?

    Read the article

  • How do I bind a click to an anchor without a framework (javascript)

    - by Stomped
    I know this is easily done in jQuery or any other framework, but that's not really the point. How do I go about 'properly' binding a click event in pure javascript? I know how to do it inline (I know this is terrible) <a href="doc.html" onclick="myFunc(); return false">click here</a> and this causes my javascript to execute for a JS enabled browser, and the link to behave normally for those without javascript? Now, how do I do the same thing in a non-inline manner?

    Read the article

  • Access PHP var from external javascript file

    - by FFish
    I can access a PHP var with Javascript like this: <?php $fruit = "apple"; $color = "red"; ?> <script type="text/javascript"> alert("fruit: " + "<?php echo $fruit; ?>"); // or shortcut "<?= $fruit ?>" </script> But what if I want to use an external JS file: <script type="text/javascript" src="externaljs.js"></script> externaljs.js: alert("color: " + "<?php echo $color; ?>");

    Read the article

  • How To Alter This Code So That It Only Redirects If There Is No Mouse Movement

    - by user1426261
    I have the following java script which redirects the user to another website (google in this case). <script type="text/JavaScript"> window.setTimeout("location=('http://www.google.com');",5000); </script> However, although i want the website to redirect to another website, i dont want it to redirect for no reason. My aim is for the website to redirect automatically on the condition that the cursor hasnt been moved for a little while. is this possible?

    Read the article

  • How to learn web-programming (Javascript, PHP)?

    - by metal-gear-solid
    If I'm going to learn programming first time, How i should start? I don't know programming yet but I'm good at XHTML and CSS. my main aim is to learn first Javascript than second PHP. after having good command in Javascript I'll move to PHP. all these i want to learn to get good command in all areas of Wordpress design and Development. Although i can use basic javascript, jquery, PHP scripts in my projects but know i want to learn programming concept and want to get good knowledge.

    Read the article

  • Javascript Code For HTML5 Form Validation Not Working

    - by MistUnleashed
    I'm new to JavaScript so I have no idea why this code does not work and validate my HTML5 Form like it should. The JavaScript code which can be found below is supposed to check if the browser supports the required attribute and if it doesn't then it will validate the form and check for any empty spaces. I got the code from this website. In the body of the webpage containing my form I have this: Below is the contactvalidate.js file: $('#formTemplate').submit(function() { if (!attributeSupported("required") || ($.browser.safari)) { $("#formTemplate [required]").each(function(index) { if (!$(this).val()) { alert("Please fill all required fields."); return false; } }); } return false; }); Do I need to change anything in this code or should it work? As I've said I'm new to JavaScript so any help you guys could give me is greatly appreciated.

    Read the article

  • JavaScript prototype(ing) question

    - by OneNerd
    Trying to grasp Prototyping in Javascript. Trying to create my own namespace to extend the String object in JavaScript. Here is what I have so far (a snippet): var ns { alert: function() { alert (this); } } String.prototype.$ns = ns; As you can see, I am trying to place what will be a series of functions into the ns namespace. So I can execute a command like this: "hello world".$ns.alert(); But the problem is, the this doesn't seem to reference the text being sent (in this case, "hello world"). What I get is an alert box with the following: [object Object] Not having a full grasp of the object-oriented nature of JavaScript, I am at a loss, but I am guessing I am missing something simple. Does anyone know how to achieve this? Thanks -

    Read the article

  • Javascript Methodname is replaced with !==

    - by dasheddot
    Hey! On the server lies a html file with javascript code included. This javascript code includes a method called something like "CheckObject". This file works for all users, except one specific (but important). He gets a javascript error and in his browser sourcode appears something unbelievable: The methodname "CheckObject" is replaced with "Check!==ect", means the "Obj" of the method name is replaced with !==. Why could that be? Hope anybody can help me! Best regards

    Read the article

  • ajax echo returns javascript code!

    - by StevanSteve
    Hi, i have an ajax call. Php page (A) called by ajax requires some other php page (B). Page "B" is php file looking something like this <html> <head> javascript code </head> <body> PHP Code </body> Inside of "head" tags is javascript code. Now, Page "A" includes page "B", but instead of expected result, it echoes pure javascript code from included page "B"! How to prevent that?

    Read the article

  • How to access object from array in if condition

    - by Happy
    Accesing array objects in javascript OBJ_ARRAY[j][i] = { "x1": w * i, "y1": h * j, "x2": w * (i + 1), "cell_color": "blue", "y2": h * (j + 1), "name": (i + 1 * (j * 10)) + 1, "z-index": 10, "status":isnotactive } I have this cell array and all its x1,y1 x2,y2 are generated dynamically. for eg. if want to compare OBJ_ARRAY[5][5].x110 then alert if(( OBJ_ARRAY[5][5].x1) > 10)) ; { alert("Done"); } It does not work any idea how it can be fixed?

    Read the article

  • selecting all text within a div on a single left click with javascript

    - by tstyle
    I have a simple non-clickable link within a div that looks like this: It's meant to be a sharable link that the user can copy paste into other things. For usability purposes, I want a single left click anywhere within the div to select the entire link: I don't know much about, javascript/web programming, so I've tried the following: <div id="share_link" onClick="select_all('share_link')"><%= request.url %></div> and this javascript <script type="text/javascript"> function select_all(id) { document.getElementById(id).focus(); } </script> This doesn't work. I'd like to know what's the simplest thing I should do to achieve what I want. I thought about changing the div to a text input or the text within to be a link, but ideally the content within should be read-only, non-editable, and non-clickable

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >