Solved

Keep getting an Error msg with "document.form.*****.value = " statements

Posted on 2004-03-25
8
475 Views
Last Modified: 2008-03-10
Can anyone clue me in to why I'm getting an error with this? I keep getting a requested semicolon for line 7, character 13, which would put it right after the first "var document", where the period is currently located. I can't see anything wrong with the code, so hopefully one of you has the eye or knowledge of what's wrong here!

Code:

Start Line 1: <html>
<head>
<script>
var links = 'http://webmastereseller.com';
</script>
<script language="javascript">
var document.app.affilink.value = links;
var document.app.textlink.value = '<a href="' + links + '">MASSIVE Webmasters Resale Package - MASTER RESALE RIGHTS!</a>';
var document.app.banner1.value = '<a href="' + links + '"><img src="webmaster_468x60.gif" width="468" height="60" border="0"></a>';
var document.app.banner2.value = '<a href="' + links + '"><img src="resalepack_468x60.gif" width="468" height="60" border="0"></a>';
var document.app.banner3.value = '<a href="' + links + '"><img src="webmaster_125x125.gif" width="125" height="125" border="0"></a>';
var document.app.banner4.value = '<a href="' + links + '"><img src="resalepack_125x125.gif" width="125" height="125" border="0"></a>';
var document.app.banner5.value = '<a href="' + links + '"><img src="webmaster_120x240.gif" width="120" height="240" border="0"></a>';
var document.app.banner6.value = '<a href="' + links + '"><img src="webmaster_120x60.gif" width="120" height="60" border="0"></a>';
var document.app.banner7.value = '<a href="' + links + '"><img src="webmaster_88x31.gif" width="120" height="60" border="0"></a>';
return true;
</script>
</head>
<body>
<form name="app">
<input name="affilink" type=text size=100 value="">
<input name="textlink" type=text size=100 value="">
<input name="banner1" type=text size=100 value="">
<input name="banner2" type=text size=100 value="">
<input name="banner3" type=text size=100 value="">
<input name="banner4" type=text size=100 value="">
<input name="banner5" type=text size=100 value="">
<input name="banner6" type=text size=100 value="">
<input name="banner7" type=text size=100 value="">
</form>
</body>
</html>
0
Comment
Question by:ziffgone
  • 3
  • 3
  • 2
8 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 150 total points
ID: 10680887

you cannot declare a variable as "document.app.affilink.value"
this is where you are getting error.

if you want to assign value simply say

document.app.affilink.value = links;
0
 
LVL 10

Assisted Solution

by:Bustarooms
Bustarooms earned 150 total points
ID: 10680919
the problem is that you're script is being run before the form is created  

you should encapsulate that whole thing in a function and call that function on load

<html>
<head>
<script>
var links = 'http://webmastereseller.com';
</script>
<script language="javascript">
function onLoadFunction(){
var document.app.affilink.value = links;
var document.app.textlink.value = '<a href="' + links + '">MASSIVE Webmasters Resale Package - MASTER RESALE RIGHTS!</a>';
var document.app.banner1.value = '<a href="' + links + '"><img src="webmaster_468x60.gif" width="468" height="60" border="0"></a>';
var document.app.banner2.value = '<a href="' + links + '"><img src="resalepack_468x60.gif" width="468" height="60" border="0"></a>';
var document.app.banner3.value = '<a href="' + links + '"><img src="webmaster_125x125.gif" width="125" height="125" border="0"></a>';
var document.app.banner4.value = '<a href="' + links + '"><img src="resalepack_125x125.gif" width="125" height="125" border="0"></a>';
var document.app.banner5.value = '<a href="' + links + '"><img src="webmaster_120x240.gif" width="120" height="240" border="0"></a>';
var document.app.banner6.value = '<a href="' + links + '"><img src="webmaster_120x60.gif" width="120" height="60" border="0"></a>';
var document.app.banner7.value = '<a href="' + links + '"><img src="webmaster_88x31.gif" width="120" height="60" border="0"></a>';
return true;
}
</script>
</head>
<body onload="onLoadFunction();">
<form name="app">
<input name="affilink" type=text size=100 value="">
<input name="textlink" type=text size=100 value="">
<input name="banner1" type=text size=100 value="">
<input name="banner2" type=text size=100 value="">
<input name="banner3" type=text size=100 value="">
<input name="banner4" type=text size=100 value="">
<input name="banner5" type=text size=100 value="">
<input name="banner6" type=text size=100 value="">
<input name="banner7" type=text size=100 value="">
</form>
</body>
</html>
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10680939
I am not sure... but I think you want something like this

<head>
<script>
var links = 'http://webmastereseller.com';
</script>

</head>
<body>
<form name="app">
<input name="affilink" type=text size=100 value="">
<input name="textlink" type=text size=100 value="">
<input name="banner1" type=text size=100 value="">
<input name="banner2" type=text size=100 value="">
<input name="banner3" type=text size=100 value="">
<input name="banner4" type=text size=100 value="">
<input name="banner5" type=text size=100 value="">
<input name="banner6" type=text size=100 value="">
<input name="banner7" type=text size=100 value="">
</form>
<script language="javascript">
document.app.affilink.value = links;
document.app.textlink.value = '<a href="' + links + '">MASSIVE Webmasters Resale Package - MASTER RESALE RIGHTS!</a>';
document.app.banner1.value = '<a href="' + links + '"><img src="webmaster_468x60.gif" width="468" height="60" border="0"></a>';
document.app.banner2.value = '<a href="' + links + '"><img src="resalepack_468x60.gif" width="468" height="60" border="0"></a>';
document.app.banner3.value = '<a href="' + links + '"><img src="webmaster_125x125.gif" width="125" height="125" border="0"></a>';
document.app.banner4.value = '<a href="' + links + '"><img src="resalepack_125x125.gif" width="125" height="125" border="0"></a>';
document.app.banner5.value = '<a href="' + links + '"><img src="webmaster_120x240.gif" width="120" height="240" border="0"></a>';
document.app.banner6.value = '<a href="' + links + '"><img src="webmaster_120x60.gif" width="120" height="60" border="0"></a>';
document.app.banner7.value = '<a href="' + links + '"><img src="webmaster_88x31.gif" width="120" height="60" border="0"></a>';

//return true;
</script>

</body>
</html>
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10680957
or as Bustarooms said.... you can do something like this.

<html>
<head>
<script>
var links = 'http://webmastereseller.com';
</script>
<script language="javascript">
function onLoadFunction(){
document.app.affilink.value = links;
document.app.textlink.value = '<a href="' + links + '">MASSIVE Webmasters Resale Package - MASTER RESALE RIGHTS!</a>';
document.app.banner1.value = '<a href="' + links + '"><img src="webmaster_468x60.gif" width="468" height="60" border="0"></a>';
document.app.banner2.value = '<a href="' + links + '"><img src="resalepack_468x60.gif" width="468" height="60" border="0"></a>';
document.app.banner3.value = '<a href="' + links + '"><img src="webmaster_125x125.gif" width="125" height="125" border="0"></a>';
document.app.banner4.value = '<a href="' + links + '"><img src="resalepack_125x125.gif" width="125" height="125" border="0"></a>';
document.app.banner5.value = '<a href="' + links + '"><img src="webmaster_120x240.gif" width="120" height="240" border="0"></a>';
document.app.banner6.value = '<a href="' + links + '"><img src="webmaster_120x60.gif" width="120" height="60" border="0"></a>';
document.app.banner7.value = '<a href="' + links + '"><img src="webmaster_88x31.gif" width="120" height="60" border="0"></a>';
return true;
}
</script>
</head>
<body onload="onLoadFunction();">
<form name="app">
<input name="affilink" type=text size=100 value="">
<input name="textlink" type=text size=100 value="">
<input name="banner1" type=text size=100 value="">
<input name="banner2" type=text size=100 value="">
<input name="banner3" type=text size=100 value="">
<input name="banner4" type=text size=100 value="">
<input name="banner5" type=text size=100 value="">
<input name="banner6" type=text size=100 value="">
<input name="banner7" type=text size=100 value="">
</form>
</body>
</html>
0
 
LVL 14

Author Comment

by:ziffgone
ID: 10681170
Ok, this was a test script I was writing to iron out the kinks of the original. In my original script the document.app.*****.value's are located in a function as suggested. This function is only called after someone inputs their email address into a different form and is called by 'onclick="bannerCode();"'.


function bannerCode(){
if (document.both.email.value != ""){
var links = 'http://webmastereseller.com?ref=' + document.both.email.value;
}
else if (document.paypal.email.value != ""){
var links = 'http://webmastereseller.com?ref=' + document.paypal.email.value + '&pay=PayPal';
}
else if (document.stormpay.email.value != ""){
var links = 'http://webmastereseller.com?ref=' + document.paypal.email.value + '&pay=StormPay';
}
else {
alert('Please enter Your E-mail\naddress into one of the\nBoxes to receive your Links');
}
document.link.affilink.value = links;
document.link.textlink.value = '<a href="' + links + '">MASSIVE Webmasters Resale Package - MASTER RESALE RIGHTS!</a>';
document.link.banner1.value = '<a href="' + links + '"><img src="webmaster_468x60.gif" width="468" height="60" border="0"></a>';
document.link.banner2.value = '<a href="' + links + '"><img src="resalepack_468x60.gif" width="468" height="60" border="0"></a>';
document.link.banner3.value = '<a href="' + links + '"><img src="webmaster_125x125.gif" width="125" height="125" border="0"></a>';
document.link.banner4.value = '<a href="' + links + '"><img src="resalepack_125x125.gif" width="125" height="125" border="0"></a>';
document.link.banner5.value = '<a href="' + links + '"><img src="webmaster_120x240.gif" width="120" height="240" border="0"></a>';
document.link.banner6.value = '<a href="' + links + '"><img src="webmaster_120x60.gif" width="120" height="60" border="0"></a>';
document.link.banner7.value = '<a href="' + links + '"><img src="webmaster_88x31.gif" width="120" height="60" border="0"></a>';
return true;
}

I'm now coming up with a "value is null or not an object" error.
0
 
LVL 10

Expert Comment

by:Bustarooms
ID: 10681232
hard to tell, think we'll need the html that goes with the script
0
 
LVL 14

Author Comment

by:ziffgone
ID: 10681640
Here you go, I really appreciate your time and effort in this, all of you!

http://ziffgone.the.cashculture.net/bannertester/

Just "view source" when you get there.

Thanks again.
0
 
LVL 14

Author Comment

by:ziffgone
ID: 10681756
Found the last problem, it was in the email checker script. DOH!

Anyways, a GREAT BIG THANKS to venkateshwarr and Bustarooms! I increased the Question's reward points and spit them between you.

Have a great day guys!

Kind Regards,
ziffgone.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question