PDA

View Full Version : Accessing the value of a document.write()


ice_white
10-15-2004, 12:58 PM
I am currently using a link to a javascript file on another server. I send accross a keyword and it returns "document.write('lalalalalalala')".

I need to access the 'lalalalalalala' without actually writing it to the page.

Is there any way of doing this?

Any help would be hugely appreciated!

Many Thanks,

Mark.

Roy Sinclair
10-15-2004, 04:47 PM
Search the returned string for the first quote mark and then use a substring to extract the contents of the returned string from that point until the second to the last character of the string.

ice_white
10-18-2004, 03:59 PM
Hi Roy,

The problem I have is, once I call the remote page, it executes the document.write() and writes it to the page.

<script language=""JavaScript1.1"" src=""http://ad.uk.doubleclick.net/adj/go4it.aji.uk/_default;abr=!ie4;kw=loans;sz=620x123;ord=749860403257001?""></script>

Is there any way I can get the return put into a variable to that I can check its contents?

andyede
10-18-2004, 04:11 PM
editing the function in the remote file springs to mind or is that not an option?

fci
10-18-2004, 04:33 PM
so you're trying to have ad on the page but make it hidden or am I completely misinterpreting what you want to do.. (trying to read between the lines here..)?
//

now all the HTML is in the advert variable and the banner doesn't show...
of course.. this probably breaks their TOS if you don't have the banner actually showing..

removed thanks to Sin's post.. so if you were trying to break a tos.. until you can give a good reason for asking for what you need... then I can't help you..

Roy Sinclair
10-18-2004, 08:06 PM
From the RULES you agreed to when you joined this forum:

# 1.4) No illegal requests- Do not post requests that are illegal or break the usage terms of the service in question, such as where to download warez, disable pop up ads on your free host etc.

See: http://www.codingforums.com/rules.htm

ice_white
10-19-2004, 11:25 AM
The remote file I cannot access, so changing that is not an option.

The banner is one that I want to display, so don't worry - I'm not breaking any TOS with my hosts.

What I want is an image above the banner, saying "Sponsored Listing" or something similar. However, only 20% of keywords passed to the file return a banner, so I can't hard-code it into the page. Otherwise, 80% of the time it would display a banner heading, but no banner!

What I need to do is put the result into a variable and check if a banner has been returned.

If yes, I'll write out the image, then the banner.

If no, I'll write out nothing (or the banner if I have to, as it would just be a 1px blank image)

Hope this helps! Thanks again,

Mark.

fci
10-19-2004, 11:34 AM
so the other 80% of the time what does it show ? it shows a pixel ? that seems odd(or maybe not, I have never had banners on my site(s))... I don't think people will care if it says "Sponsored Listing" or not. A banner is a banner.

ice_white
10-19-2004, 02:00 PM
I think it's a 1 px image anyway - it might just leave it blank.

It's not quite a banner, for example you can start off an insurance quote by selecting the make and model of car from drop-downs.

People do see it as just a banner though, which is why I want to put this title above it so as to distinguish it from the rest.

fci
10-19-2004, 02:08 PM
mmm

you do know it says "SPONSORED CONTENT" above the banner? what do you have to say about that?

ice_white
10-19-2004, 02:28 PM
We asked them to put a title on it, which was our logo with an arrow and then the title, but they said it had to be generic because the same would show on all of their other advertisers.

They told me that the only way to do it would be to put the response into a variable and check for the banner, but they didn't actually know how to do it.

Which is why I registered here to see if anyone else knew how! ;)

If you're worried that the same code could be used illegally by someone else, then you could always email/PM it to me.

ice_white
10-19-2004, 02:35 PM
FCI - I've just figured out how to prove it's not the sort of banner that has to appear on my site (for free hosting or whatever) - I have control over what keyword it searches for.

If I didn't want the banner to display, I would just put "gobbledigook" as the keyword!

Roy Sinclair
10-19-2004, 08:35 PM
Perhaps you can approach this from a different direction, take a look at this thread: http://codingforums.com/showthread.php?s=&threadid=14463

Is it possible you could use that function which is normally used to read a file via a URL into an array to retrieve the content?

ice_white
10-20-2004, 10:15 AM
Hi Roy,

Apparently this won't work unless the script is on your own domain, which it isn't (unless using IE5.5).

ice_white
10-22-2004, 03:54 PM
top

Has anyone got any other ideas???

TxKatt
11-02-2004, 09:57 PM
I'm hoping one of you can help me with passing the document.write value ... it will be hard to explain without giving you links which I don't want to post here, but will share through PM... here's the basic idea :

I have a shopping cart which uses PayPal. On the same page as the shopping cart buttons, I have a value which has been passed from the url to a form field on the page with document.write - I need to send that value to PayPal to show up on the payment information that I receive from PayPal.

Also, please note that I am very much a beginner with javascript programming, but am an eager learner!

Thanks for any help you can offer.

fci
11-02-2004, 10:19 PM
I'm hoping one of you can help me with passing the document.write value ... it will be hard to explain without giving you links which I don't want to post here, but will share through PM... here's the basic idea :

I have a shopping cart which uses PayPal. On the same page as the shopping cart buttons, I have a value which has been passed from the url to a form field on the page with document.write - I need to send that value to PayPal to show up on the payment information that I receive from PayPal.

Also, please note that I am very much a beginner with javascript programming, but am an eager learner!

Thanks for any help you can offer.


I suggest starting a new thread with your post... as opposed to making your post in an unrelated thread.

joh6nn
11-03-2004, 12:44 AM
can we see the page this is on? i think i might have an idea, but i'd like to see the rest of the page, before i say anything.

i had actually been replying to ice_white's question; i hadn't even noticed there was a second page to this thread. as fci said, in the future, please start your own thread, instead of hijacking an older one; it tends to create this sort of confusion.

TxKatt
11-03-2004, 10:36 PM
Sorry for the confusion... but thanks for sparking something in my brain that resulted in me fixing this myself!! :D