473,391 Members | 1,489 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,391 software developers and data experts.

setting form values via external js file ... trying to use document.form.filed.value

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

document.forname.fieldname.value = xx;

I would imagine document no longer applies since external js file. How
can i do this from an external js file.

thanks.
Jul 23 '05 #1
3 2075
On 7 Nov 2004 08:27:23 -0800, <ja***@cyberpine.com> wrote:

[snip]
document.forname.fieldname.value = xx;

I would imagine document no longer applies since external js file.
Not at all. The script will act exactly as it would had you pasted the
contents within a SCRIPT element.
How can i do this from an external js file.


As you normally might.

Could you show an example, preferably presenting a small demonstration
somewhere on the Web.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
Thanks for response.

I found my bug. I had left the <script language> tag in the .js file
.... and apparently you can't have html in an external js file so the
function was not being found.

Incidently, what's the best way to expand on these javascript errors
you might get at the bottom of the browser screen. Any way to get more
detail, and maybe a line number or something. I'm using IE 6.0.

Thanks.
Jul 23 '05 #3
On 8 Nov 2004 05:45:04 -0800, <ja***@cyberpine.com> wrote:
Thanks for response.
You're welcome.
I found my bug. I had left the <script language> tag [...]
The language attribute is deprecated, by the way. It has been for over six
years. The script type should be specified using the type attribute:

<script type="text/javascript">
... and apparently you can't have html in an external js file so the
function was not being found.
No, you certainly can't. The external file should only contain content
that is valid for the script language.
Incidently, what's the best way to expand on these javascript errors you
might get at the bottom of the browser screen. Any way to get more
detail, and maybe a line number or something. I'm using IE 6.0.


You can add the Microsoft Script Debugger, but I found it cumbersome to
use. I would recommend using another browser, which is generally a good
idea for Web development anyway as you don't fall into the trap of using
Microsoft-only "features"[1].

Opera's Javascript console automatically includes a trace through your
script that's very useful in determining what went wrong, where. The
development tools that come with the Mozilla Browser Suite and Mozilla
Firefox are also better than the IE console.

Opera <URL:http://www.opera.com/>
Mozilla <URL:http://www.mozilla.org/>

Mike
[1] Unless you're developing for a Microsoft-only environment, of course.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4

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

Similar topics

3
by: Bob | last post by:
I'm a total newbie at Javascript, but a programmer for over 20 years... so, my plans may be bigger than they are possible. I'm trying to set with Javascript the value of a form field... easy...
2
by: umashd | last post by:
Hi, I am doing a web based project for my graduation. I studied bit of java for backend processesing and javascript for the client. Here is the scenario. In the FORM, I use INPUT TYPE=text...
2
by: dan_matthew | last post by:
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...
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"...
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? -----------------------------------------------------------------------...
8
by: ridgedale | last post by:
I wonder if anyone could explain how I pass the field values in my request form to the PHP processor page. My external javascript file is as follows: var sections = ; for (var i=0; i <...
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...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.