Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 28th, 2005, 10:10 PM
Authorized User
Join Date: Nov 2005
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:

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

Old November 29th, 2005, 06:26 AM
Friend of Wrox
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post

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



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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.