Solved

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

Posted on 2004-03-25
8
482 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

705 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