Solved

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

Posted on 2004-03-25
8
468 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now