473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Setting form values with external .js file

hi,
i'm trying to set a form value via an external js file. i don't know
javascript extremely well but i do know programming in general. anyway,
i thought this would be as easy as having a javascript file saved as
..js, and clicking it when i get to the page where i would like to set
the form value, with a code that looks like this -

document.form[0].myTextBox = "Search Term";

... if i click on this though, i get the error "document not defined."
can anyone help? as a concrete example, can someone show me the code
to, say, set the search textbox to the value "javascript" on
google/yahoo with said javascript file?

thank you thank you!

dan matthew

Sep 30 '05 #1
2 1979

dan_matthew wrote:
hi,
i'm trying to set a form value via an external js file. i don't know
javascript extremely well but i do know programming in general. anyway,
i thought this would be as easy as having a javascript file saved as
.js, and clicking it when i get to the page where i would like to set
the form value, with a code that looks like this -

document.form[0].myTextBox = "Search Term";
It's plural:

document.forms[0].myTextBox = "Search Term";
.. if i click on this though, i get the error "document not defined."
can anyone help? as a concrete example, can someone show me the code
to, say, set the search textbox to the value "javascript" on
google/yahoo with said javascript file?

thank you thank you!

dan matthew


Sep 30 '05 #2
Thank you for replying. I tried this, changing it to -

document.forms[0].myTextBox.value = "Search Term";

.... but I'm still getting the error message 'document' is undefined.

To add a little info in case it's relevant, what I do is I go to the
page where the text box is, then click on the javascript file which is
set as a favorite.

Any help will be much appreciated!

Sep 30 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: blu4899 | last post by:
Hi, The Xerces XML parser is reading external DTD references in DOCTYPEs by default, but is not doing anything with them because validation is turned off by default. This is documented in...
3
by: jason | last post by:
I have a function that <body onload=..> sets some form values. However when i execute that functionf from external js file, i get erorrs and it dont work. The function sets the fields via ...
7
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well....
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
3
by: crescent_au | last post by:
hi all, i am creating a form that returns to itself like this: <form name="form1" action="<?php echo $_REQUEST; ?>" method="post"> Upon clicking submit, I want the form to return to "itself"...
2
by: ravisuguna | last post by:
Hi, I have a php page which has some checkboxes ,textfields and values.If I select a checkbox ,a particular value will be displayed in a textfield.I have a "go"button in the same page.I want the...
2
by: bilalinamdar | last post by:
hello this is my first post in this forum... I am just a BEGINNER.. Not much Understanding.. I have a website which consist a BOX and a Submit Button I would like to make a custom setting to...
8
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.