Forums

This topic is locked

Help - New at extensions and jscript :P

Posted 06 Sep 2001 00:45:36
1
has voted
06 Sep 2001 00:45:36 I Mahomed posted:
Any idea wot dis error means i know im gonna seem stupid :\ i tried creatin an object from dreamweaver simple jscript but it gives me the following error when i try to insert

"At Line 4 of file Absol.htm: Location is Not defined"

Code Below
----------
[var dt = new Date();
document.write('<a target="_blank" href="stats.absol.co.za/showstats.asp?ownerid=8061"><img src="stats.absol.co.za/image.asp?ownerid=8061&pid='+escape(location.href)+'&atc='+Math.random()+'&ref='+escape(document.referrer)+'&ttl='+escape(document.title)+'&tzn='+dt.getTimezoneOffset()+'&js=yes" border=0></a>');
document.write(dt);
//-->]

Replies

Replied 06 Sep 2001 17:02:12
06 Sep 2001 17:02:12 Joel Martinez replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>[var dt = new Date();
document.write('&lt;a target="_blank" href="stats.absol.co.za/showstats.asp?ownerid=8061"&gt;&lt;img src="stats.absol.co.za/image.asp?ownerid=8061&pid='+escape(location.href)+'&atc='+Math.random()+'&ref='+escape(document.referrer)+'&ttl='+escape(document.title)+'&tzn='+dt.getTimezoneOffset()+'&js=yes" border=0&gt;&lt;/a&gt;');
document.write(dt);
//--&gt;]<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Hmm, well, I think the first question we need to ask is, Where is this code being run?

is it being run in a UD extension? or in a browser?

if it's in an extension, then I don't think you can use the location object is available in an extension...

if it's in a browser... I don't know.
I copy/pasted the code into an htm file on my box, and it worked fine, it showed the image just fine.

Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/
Replied 06 Sep 2001 19:49:27
06 Sep 2001 19:49:27 I Mahomed replied:
it is used in the browser the code should be inserted at the point where the cursor is <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>


Replied 06 Sep 2001 20:54:08
06 Sep 2001 20:54:08 Joel Martinez replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>it is used in the browser the code should be inserted at the point where the cursor is <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle><hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
you've got to make the script into a string, so any single quotes need to have the escape character in front of them... like so<pre id=code><font face=courier size=2 id=code>str = "str= \'This is a script in a script\'";</font id=code></pre id=code>notice how the string in the script, is just another script... that will insert the right code from the object...

Joel Martinez [ ]
----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
'2nd place is just 1st Loser
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/

Edited by - joelmartinez on 09/06/2001 20:56:59

Reply to this topic