Document.forms Problem
Jun 27, 2006
I have some code on a page that will enable/disable a text box if a
checkbox has been checked/unchecked and it seems to be working fine
unless there is only one checkbox and one text box.
Here is the javascript:
function EnableCustLoyaltyNotes(x,y)
{
if (document.frmCustLoyalty.VoidLineID[x].checked ||
document.frmCustLoyalty.UnVoidLineID[x].checked)
{
document.frmCustLoyalty.Notes[y].disabled = false;
}
else
{
document.frmCustLoyalty.Notes[y].disabled = true;
}}
Pretty simple, here is the code on the page:
onClick="EnableCustLoyaltyNotes(Ɔ',Ɔ');"
Any ideas on why its not working?
View 1 Replies
ADVERTISEMENT
Mar 12, 2004
I'm not a JS person, so hopefully this'll be nice an easy .
The follwoing bit of code:
Code:
<script language="javascript">
// if form exists , set cursor in first input field
function focusonform()
{
if (document.forms[0]) {
document.forms[0].elements[0].focus();
}
else
{window.focus();}
}
</script>
This appears to work fine on a page with no forms using Mozilla 1.0, IE6 on win2000. But NOT on IE6 on XP - I get the following message:
A Runtime Error has occured.
Do you wish to Debug?
Line: 70
Error: 'document.forms.0.elements.0'
View 1 Replies
View Related
Jul 23, 2005
Why doesn't this work - no errors, just no value when text is in textbox
var fn=document.forms[0].elements[7].value;
View 3 Replies
View Related
Dec 21, 2006
I would like to know if is better to use document.forms to detect forms
or getElementById.
View 2 Replies
View Related
Jul 20, 2005
A straight forward problem I think but my knowledge of JavaScript lets
me down.
I am taking in a lot of input using a form. After preparing an email
(FormMail.pl) I then use 'document.write' to create a new page with
all the users details nicely formatted. This includes checking radio
buttons, checkboxes etc.
Problem is as soon as I use the first 'document.write', the form and
all its contents are undefined. I have moved some of them to variables
for the time being but this is cumbersome.
View 2 Replies
View Related
Jul 20, 2005
I have a problem to access a hidden field by javascript. The name of
the field has a dot in it. That's the problem. But I need that dot
because it is a "Stuts Property".
I'm using IE 6. This is my code:
View 4 Replies
View Related
Apr 28, 2006
I've been tryin to figure out why I am getting this error for some time now. Any ideas?
<script language="Javascript">
<!--
var lead_id = "<?php echo $LeadID; ?>"
if (lead_id > "") {
var state = "<?php echo $row['State']; ?>";
var confirmer = "<?php echo $row['Confirmer']; ?>";
var day = "<?php echo $row['ApptDay']; ?>";
if (state == "MD") {
alert("hi");
document.forms['form1'].state.options[0].selected = true;
}}
//-->
</script>
state is equal to MD so I am getting the alert "hi", but it breaks right there and gives me this error. document.forms.form1 has no properties heres my form tag:
<form name="form1" id="form1" action="ticketformpro.php?LeadID=<?php echo $LeadID; ?>" method="post">
View 2 Replies
View Related
Feb 23, 2009
I'm trying to get a form submit working for all browsers, and I am using document.forms['formname'].submit().
However, despite having 'formname' set on the forms in both the name and id properties, Safari 3 will not submit the form correctly; when I debug, $_POST is empty. IE, FF both work here fine. If I use document.forms[0].submit() it works correctly, but this code will be working in a dynamic site where I can never be sure at what index a given form will reside. I can make it work using document.getElementById('formname').submit(), but that does not work with js turned off, and I need this to work with js on/off.
View 6 Replies
View Related
Oct 19, 2010
I am working on a simple javascript craps game program. I need some advice since it won't display who the winner is, keep tally of who wins/loses, and the number of total games played. After using the error console there's an error with document.forms [0].thrower.value not being defined.
<html>
<head>
<title> JavaScript Craps Game</title>[code]....
View 13 Replies
View Related
Apr 18, 2010
I have a javascript function which lets a user to choose one of the 7 option buttons on a "mainsub.asp" page and the page will then be forwarded to one of the 7 process pages depending on what has been chosen. The problem is that firefox is angry with the first line ("if" statement) and tells the following in its error console:
[Code]...
View 2 Replies
View Related
Sep 16, 2010
I want to make few forms but 1 submit button. I want to do 1 page , 5 forms , 1 submit button so when i click on the submit button it will send the 5 forms as 1 form.
View 2 Replies
View Related
Nov 14, 2011
how to add forms in javascript, but it's limited to text input forms.
<script type="text/javascript"><!--
function updatesum() {
document.form.sum.value = (document.form.sum1.value -0) + (document.form.sum2.value -0);
}
//--></script>
Where the inputs sum1 and sum2 are text fields you put whatever numbers you want in. That works fine. Great. Now what I'm having trouble with is modifying the code so that it will add one form with an input number with a form that spits out a randomly generated number.
<input type="button" value="D20" onclick="this.form.display.value = Math.round (20 * Math.random())" class="buttonHi" /> <input name="display" type="text" size="6" value="" />
This is what I'm using for my random number generator. So basically I want to be able to put, say, 5, into the input text field above this. And then click on the d20 button to get a random number, say, 15, and then have the first code add the inputted 5 with the randomly generated 15.
View 4 Replies
View Related
Sep 6, 2009
Suppose a HTML document has a iframe. Using javascript,I want to detect ,on load of the html document, whether the body of the iframe document is ready to be displayed.I want to be able to overwrite the the body contents (before it actullay loads) of the iframe.can I do it with jquery? say if ,HTML doc is
Code:
<html><head></head><body><iframe id="ifrmId" src="http://www.google.com" ></iframe></body></html>
View 1 Replies
View Related
Feb 9, 2010
i want to save my html document as an microsoft word document will
View 14 Replies
View Related
Mar 17, 2007
Normally an SVG document is loaded/parsed/interpreted inside an HTML
document using an 'object' (or 'embed') element, although there are
supposedly other ways too. The problem is, the SVG document must be
static this way.
I want to use the DOM interface to build SVG dynamically inside an HTML
document. I am guessing I can build it inside HTML within an 'object' (or
maybe 'iframe'?) element.
My intentions/goals:
In Javascript, I construct an object 'embedSVG' which has properties and
methods for creating valid SVG elements and setting their attributes and
attribute values.
During construction, the SVG document is created with its root element.
During debugging in FF 2.0 (I'll work on an MSIE-compatible format later),
I am using the Mozilla DOM Inspector and comparing nodes when the
'object' element is loading a valid external SVG document, and when I am
appending the child representing the SVG document created by the DOM
functions.
However the child node (#document) does not specify 'svg' as the root
element, but instead 'HTML'. Something is not working.
Here is the relevant code in 'ScriptTest.html' which is the HTML in which
the SVG is supposed to be embedded. Below it is the relevant code for
'svglib.js' which is supposed to contain code for building the SVG
dynamically.
What this code is supposed to do is load the HTML page and execute the
anonymous script, and draw a navy blue-bordered yellow rectangle on a
blank page. This is similar to the example in the SVG 1.1 W3C
Recommendation on page 202 of the 719-page PDF.
I am getting an exception when embedSVG object placeInHTML() method is
called: NS_ERROR_DOM_HIERARCHY_REQUEST_ERR. I find in DOM Inspector in
spite of or after the exception that a document is placed as a child of
the object element, but it is HTML, with a default 'head', 'title',
'body' elements placed.
Where am I blowing it?
View 3 Replies
View Related
Jul 24, 2001
Determine what the previous page was that the user was viewing, even if the user arrived at my site by through the use of a browser function (history, location bar, refresh, etc.). Is this possible?
I'm not wuite sure how document.history functions - what degree of privacy is given to the user and to what extent can web pages get URLs from the user's history?
View 2 Replies
View Related
Dec 6, 2010
I am trying to make a function run if the mouse is moved over the document but when using the object onmousemove it seems to run the code even if the mouse is still over then document, how can I make it so if the mouse is over the document but isn't moving then don't run the code but once the mouse moves run the code? This is the code I made to handle the mouse move collections.
[Code]..
But with this code it runs even when the user doesn't move their mouse and the notification box pops up every second as the code seems to think a still mouse is a moving mouse.
I was thinking about having a run once system but that would mean if the mouse moves it runs once and then if the mouse moves again the code will not run as it has already ran before.
View 5 Replies
View Related
Oct 26, 2007
I want to switch a big function from a document.onkeydown = function to a document.onkeypress = function, or vice versa depeding on the type of browser.
However it is quite a big function so it's pretty much out of the question to have it appear in full twice.
Any ideas how to change the target event (onkeydown/onkeypress) without writing the whole function twice?
View 8 Replies
View Related
Apr 22, 2006
I am working on creating a document where you check a bunch of checkboxes to select what to include, then click on a button. A function then opens a new window and writes the HTML code to run scripts in .js files to populate the page. Code:
View 4 Replies
View Related
Jun 5, 2006
I have been searching for a way to trap changes done to the document object (mainly by the function document.write();).
Example of code that doesn't work:
function myFunction() {
ed.document.onchange = doFunction(document.body.innerHTML);
ed.document.open();
ed.document.write('Hello');
ed.document.close();
}
function do_function(body) {
alert(body);
}
It only fires when the page loads, not when I change the text. You are free to use any event that works, but i think onchange was the one to fit this problem. The alert will write the initialpage, but will never write the tekst 'Hello' that is the new change.
Any javagurus out there know a solution to pick up any fired events triggered by document.write();
View 6 Replies
View Related
Jul 16, 2010
I am trying to write a bunch of text onto a new document using document.write() and somehow need to format it to include line breaks.
For example:
Code JavaScript:
document.write(Line 1);
document.write(Line 2);
I have tried including and it does not work. I have also tried document.writeln() and that also does not work. From what I have found on the Internet, one (if not both) of those methods should have worked.
View 3 Replies
View Related
Mar 2, 2011
I have created a servlet that does nothing more than create a XML file.i have got some JQuery code that reloads the servlet to get the XML data.This works fine and i am able to load the data i want, the problem i have is that when the data is loaded to the jsp page it displays [object Document] in front of my output.
Code JavaScript:
$(document).ready(function() {
setInterval(function() {[code]....
XML file only has one value, called row 1 with the data, "wow this is cool", but my output is: [object Document]
View 1 Replies
View Related
Sep 19, 2005
does anyone know of any javascript method that does the same job as
document.write(), but not necessarily at the end of the document? For
instance, insert some text inside an element that has a specific ID
tag?
View 25 Replies
View Related
Nov 4, 2007
sometimes document.write doesn't work for me but document.writeln always does..
View 3 Replies
View Related
Oct 28, 2009
I have three files:
HTML file (default.htm)
Code:
<body>
THE QUICK BROWN FOX JUMPED OVER THE LAZY OLD DOG
<script type="text/javascript" src="testing.js"></script>
[Code]....
When I run the above files the original text on default.htm is wiped and replaced by the document.writeln text in test2.js. What I wanted to happen was for this text to be added to the default.htm page (and not wipe what was already there). I believe this is because the htm file has already parsed.
I know people say you should use innerHTML and not document.write or document.writeln. Unfortunately, I have no control over the contents of the first file (default.htm) or the third file (test2.js) but the content in test2.js will always be in either document.write or document.writeln format. So I cannot use innerHTML.
My problem is how can I (from within the second file, testing.js) ensure that the page is not parsed before the third file has finished.
View 5 Replies
View Related
Jul 31, 2003
I need to eliminate the document.write for this bit of code
copyright=new Date();
update=copyright.getFullYear();
document.write("Copyright © 2001-"+ update + " " );
var showtext = "Tecknetix";
var mailpart1 = "webmaster";
var mailpart2 = "tecknetix.com";
document.write("<a title='email tecknetix' class='hov' href=" + "mail" + "to:" + mailpart1 + "@" + mailpart2 + ">" + showtext + "</a><br />");
The reason is now I'm using <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> with xhmtl 1.1
Since I've changed the MIME type to application/xhtml+xml from text/html the document.write is invalid now.
Here is a page with a demo on it so you can see how they changed document.write("<link rel="stylesheet" ...") around.
http://www.xml.com/lpt/a/2003/03/19/dive-into-xml.html
I think only the Moz1.4 supports application/xhtml+xml
You can see it on my 4 page site. http://www.tecknetix.com/
In IE6 you can read the copyright notice but in Mozilla you can't. But in you go to view > page info in Moz - you can see application/xhtml+xml as the type.
View 4 Replies
View Related