how to get the return values from JavaScript function inside of Html?

I have a html form

Inside of this form in select option i have called one java script function like

<form> <SELECT NAME="sel" onChange="split('1')"> <OPTION VALUE=1>Milk</option> <OPTION VALUE=2>tea</option> <OPTION VALUE=3>water</option> <OPTION VALUE=4>coffee</option> </SELECT> </form> function split(str) { var str=str+str; return str; }

Now i need to get these return value on inside of the form for example in another select

<SELECT NAME="sel123" > <OPTION VALUE="str">Milk</option> </SELECT>

can anyone help me?

-------------Problems Reply------------

HTML can't do anything with variables. It isn't a programming language.

You aren't very specific about what you want to do, but it will probably involve writing JS to perform DOM manipulation.

You can have a place where you can display the value. For example.

function split(str)
{
var str=str+str;
$('classoridofelementhere').html(str);
}

EDIT

Here is an example on how to move option from one list to another: http://calisza.wordpress.com/2009/03/29/6-jquery-snippets-you-can-use-to-manipulate-select-inputs/

Remember to download and put a reference to jQuery library.

Category:javascript Views:0 Time:2012-01-11
Tags: javascript

Related post

  • How to get html to print return value of javascript function? 2011-08-05

    What is the preferred syntax to get html to print return value of javascript function? function produceMessage(){ var msg= 'Hello<br />'; return msg; } EDIT: Yikes, too many answers without me clarifying what I meant. I know how to do it via th

  • How do you return values from javascript functions 2013-02-26

    I'm using the js library in Dart to access OpenLayers. Pertinent code looks like: js.scoped(() { ol = js.retain(js.context.OpenLayers); var max_extent = new js.Proxy(ol.Bounds, -13652354.432172, 6026153.418145, -13574082.915218, 6065289.1766216); var

  • Calling javascript function inside jquery ajax response file code 2011-01-19

    I am trying to call date_cal() javascript function inside ajax response (wall_list.php).Every thing is fine am getting correct response. But its not calling date_cal() function. main file: $.ajax({ url: 'wall_list.php', data:"dt_from="+dt_from+"&

  • javascript function inside jquery template 2011-01-20

    Seems I am having some issues calling a javascript function inside a jquery template. I've got a demo set up here: http://jsfiddle.net/SXvsZ/8/ Code looks like: function htmlDetail(){ return "hello <strong>world</strong>"; } var book = [

  • How to execute a page contain javascript function inside ajax response page? 2011-07-04

    Well, here I got stuck literally the whole day to sort out the problem that im facing now. Let me explain… *photo.php - (Main php file)* …. …. (header goes here…) …. *<script src="scripts/photogallery.js" type="text/javascript"></script>*

  • How to change a model property from a javascript function inside a view? 2010-10-12

    Is there any way to alter my Model properties from a javascript function inside a view? Specifically, I have an edit view and need to access a string property value with function SomeJSFunction() { var somevar = '<%=Model.Property %>'; ... then

  • Problem in returning values from javascript function to flex 2009-07-06

    In the attached flex code, I am trying to call a javascript function in its HTML wrapper. The example is also live at : http://www.cse.epicenterlabs.com/mbm/ajax_api.html The problem I am facing is, that I have to click the button twice to get the de

  • Jquery Replace with return value of Javascript function 2009-12-27

    OK I am just starting out with jQuery. I have a page with a table of date-values. Each is wrapped in a tag which I can find with $('mytag'). <mytag>2009-10-31</mytag> How, using Jquery, would I take each of the source values and pass it t

  • how can i use returned values from javascript functions in php? 2011-05-11

    <script type="text/javascript"> function mehdi(rno) { alert(rno); return rno * 10; } </script> <input type="button" name ="submit" value="ثبت و تایید" onclick= " mehdi('10')"> <?php ?> how can i use from returned value from me

  • Do I have to return something in javascript function? 2011-06-03

    In JavaScript functions, do I need to return something (true or false) ? So far, all the functions I wrote without returning anything work just fine. I'm just curious. --------------Solutions------------- No; Javascript functions are not required to

  • return DOM in javascript function 2011-07-05

    I am trying to write a javascript function to parse a bit of the DOM tree and return a part of it to further parse. Despite stepping through the function which seems to be working fine, the return of the function shows as undefined to the calling sta

  • How to determine the forward address based on the return values of JavaScript Function? 2011-08-11

    I have created a HTML5 Form and now on the click of the submit button I call a JavaScript function. I want to determine which page to display next ("success.html" or "error.html") based on the value returned from the function (true or false respectiv

  • How do I return information to javascript function in Objective-C? 2012-04-05

    Let's say I have a UIWebView with some javascript functions. I want those javascript functions to be able to request information from my app and my app should return it. I am able to get the requests using URL Schemes however, I don't know how to ret

  • How collect onclick return value from javascript function 2012-04-07

    I have created anchor with onclick event which calls javacript function,where as js function returns some value. i want use that value for other JS function. e.g loading() will return me some value which will get passed to another js function how to

  • Get returned value from javascript function 2010-12-02

    function get_new_project_id() { function subFunction() { $.ajax({ url: 'includes/ajax.php?request=create_untitled_project', success: function(response) { return response; // result is a number like 19 } }); } return subFunction(); }; var resultnumber

  • Problems getting the right value returned in a javascript function 2012-02-07

    What I'm trying to do is simulate a simple paper, rock, scissors game within a page, where one player selects r/p/s with radio buttons, submits his choice, and player 2 does the same. I have no doubt there are multiple problems to this code, but I se

  • How can I create JavaScript functions inside a loop with local data? 2009-08-26

    This question already has an answer here: JavaScript closure inside loops – simple practical example 21 answers See: for (var i in this.items) { var item = this.items[i]; $("#showcasenav").append("<li id=\"showcasebutton_"+item.id+"\"><img s

  • Javascript, function inside function problem 2011-02-18

    Hey, I was working with a javascript project and reached a problem that I just don't understand. Here is the code, it's not the one that I use in my project, but it's a simplified version. var x; function FetchBox() {alert("Worked");} function A(m,n)

  • How to modify a javascript function inside an iframe using bookmarklets? 2011-03-25

    Lets say I have a html page with an iframe, which has its own javascript functions. function foo(){ //doSomething } The web browser is pointed to the main page. Both the main page and the iframe are in the same domain. I can access/call those functio

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.178 (s). 11 q(s)