3 Replies - 10483 Views - Last Post: 22 September 2008 - 09:33 PM

#1 nila  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 156
  • Joined: 05-January 08

passing parameter from html to javascript

Post icon  Posted 22 September 2008 - 12:40 AM

Hi
I am having a js program which makes call to an extension number .Now i need to design a html page which is having a textbox and dial button.If we enter any number in the textbox and press the dial button,the javascript function should be called and that number entered should be called.How can i get the parameter from the html in javascript.

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: passing parameter from html to javascript

#2 pemcconnell  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 54
  • View blog
  • Posts: 472
  • Joined: 05-August 08

Re: passing parameter from html to javascript

Posted 22 September 2008 - 01:21 AM

You would just point to the text box from javascript.

e.g.

<input type="text" id="myTxt" value="" />

<input type="button" id="myBtn" value="Click Me" onclick="java script:alert(document.getElementById('myTxt').value);" />


This post has been edited by pemcconnell: 22 September 2008 - 01:22 AM

Was This Post Helpful? 0
  • +
  • -

#3 nila  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 156
  • Joined: 05-January 08

Re: passing parameter from html to javascript

Posted 22 September 2008 - 02:03 AM

thanks for your reply.my code in javascript session.js is
session1 = new Session();
session1.originate(session1, "{ignore_early_media=true}sofia/internal/1000");

session1.execute("bridge", "sofia/internal/1001");

session1.execute("transfer", "1001");




here where i have to include the lines given by you?
Was This Post Helpful? 0
  • +
  • -

#4 nila  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 156
  • Joined: 05-January 08

Re: passing parameter from html to javascript

Posted 22 September 2008 - 09:33 PM

Hi ,
As you told i have used document.getelementbyid like the following to get the value in the textbox.
code is:
	  
	<html>
	<head>
	 
	</head>
	<body>
	  <input type="text" id="myTxt" value="" />  
	<input type="button" id="mybtn" value="click me" "java script:alert(document.getElementById('myTxt').value)" > 
	<script type="text/javascript">
		var num=document.getElementById('myTxt').value;
		document.write('myTxt').value;
	session1 = new Session();
	session1.originate(session1, "{ignore_early_media=true}sofia/internal/1002");
	 
	session1.execute("bridge", "sofia/internal/1001");
	 
	session1.execute("transfer", "1001");
	</script>
	\</body>
	</html>
	 


I can able to receive the value in an alert box which is entered in the textbox.But i need to get the value and place it in tne place 1001.how can i do this?Any suggestion please?
Thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1