Solved

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

Posted on 2004-03-25
8
472 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maps stopped work unsure why 7 34
javascript comparing two dates 3 18
Index on a Table 6 9
alert(innerHTML); 8 12
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

776 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