Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript 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 17th, 2004, 08:53 PM
Authorized User
 
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default having trouble with document object

I am dont use javascript that much, I jsut do a few things here and there - but I am not sure if I am allowed to do this....I am creating numerous dynamically generated forms...each form has a button that on the onclick event data is check(verified) and then that form is sent in order to know which form it is that has to be sent I need to send the form name in a variable to the javascript function....but I am running into problems....if I try to do this

<script language="javascript">
function send()
{
var x="updateform1";


    document.x.submit()


}

</script>

I get an error document.x is not an object...
but if I did
document.updateform1.submit()

it works fine - how do I subsitute a variable in the document object???

thanks Adina

 
Old November 17th, 2004, 09:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

try ;

document.forms[x].submit();

or

eval("document." + x + ".submit()");





Similar Threads
Thread Thread Starter Forum Replies Last Post
document.lcoation.href is null or not an object IceXia Javascript How-To 2 November 24th, 2004 04:44 AM
document null or not an object Adam H-W Javascript 2 April 22nd, 2004 05:59 AM
Trouble validating an XML document with a Schema cxs00u XML 0 March 2nd, 2004 12:22 PM
document null or not an object Adam H-W Javascript How-To 2 February 18th, 2004 01:25 PM
trouble w/ command object and parameters RbH All Other Wrox Books 0 August 5th, 2003 12:31 PM





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