Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 28th, 2005, 10:10 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default passing params on an href function call

Hi you all:

I am trying to invoke a function and pass a string parameter using an <a href=... element, but keep getting an error. Passing a number works ok. The parameter data would come from the hidden input field.
Is it a matter of syntax or it cannot be done?

Here is the code:

#65279;<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META NAME="GENERATOR" Content="Microsoft Visual Studio">
<TITLE>Test</TITLE>
<script language="JavaScript">
function anyFunc(vparam)
{
    var oTR=window.document.all.DDTable.insertRow();
    var oTD=oTR.insertCell();
    oTD.innerText=vparam;
}
</script>
</head>
<BODY>
<input type="hidden" name="hdnName" value="ABC">
<table cellspacing=1 cellpadding=1 width=300 border=1 id="DDTable" >
  <tr>
    <td><a href='javascript:anyFunc()'>Test data</a></td>
  </tr>
</table></BODY></HTML>


Reply With Quote
  #2 (permalink)  
Old November 29th, 2005, 06:26 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

You don't appear to be passing any parameter in your code. When you pass a string, is it in quotes?

Cheers,

Chris

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call to function Awkuzu BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 September 19th, 2007 06:13 PM
Passing a Session Variable in a href orcabelle ASP.NET 2.0 Basics 3 May 21st, 2007 03:41 PM
Passing Params to User Controls in ASP 2.0 (VB) gcm_uk ASP.NET 2.0 Basics 8 April 30th, 2007 01:35 PM
Call a Function stealthdevil Access VBA 2 November 2nd, 2006 10:38 AM
How to call javascript function from VB function vinod_yadav1919 VB How-To 0 February 13th, 2006 06:03 AM



All times are GMT -4. The time now is 07:50 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.