Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-27-2010, 12:32 PM   PM User | #1
jan lee
New Coder

 
Join Date: Aug 2010
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
jan lee is an unknown quantity at this point
Question Open urls sequencially

Hello,

How I open urls sequencially - one by time -, but automatically (each 5 seconds) from a list with dozens of URLs in the same iFRAME?


I have what i think it is a simple question to answer.

I have a button to open a new link in a iframe (in the same browser window). And what i need is that after i press the button, the link opened would come from a list of html sequencially.

I dont want that the html opened would be from a random choice, but i want to be sequential.

I hope that i'm being clear in my line of thought. Is this possible?

cheers!!!

Jan Lee
jan lee is offline   Reply With Quote
Old 08-27-2010, 07:39 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
??? First you said
Quote:
automatically (each 5 seconds) from a list
and then you said
Quote:
i press the button, the link opened would come from a list
So which is it???

Automatic? Or only when the button is pressed?

And what happens when you get to the end of the list? Do you go back to the top or say "no more links"???
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 08-27-2010, 07:50 PM   PM User | #3
jan lee
New Coder

 
Join Date: Aug 2010
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
jan lee is an unknown quantity at this point
Well,

I have to press the button! I want to simulate a simple and fan web crawler. Taking a list of urls the script open one by one stripout and save the contens into a database. The first part would be written in Javascript the end in ASP.

I have "similar" thing using a HTA file, but I need press the button every time.

At the end of the lins list it will stop simply.



Jan Lee
jan lee is offline   Reply With Quote
Old 08-27-2010, 08:05 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Oh...you can't.

You can't strip content using JavaScript. Period.

You could load the URLs into a frame, yes. But then your JS code could not possibly "read" the contents of the other frame.

Cross-domain scripting is not allowed.

You *could* do this all in ASP code, but not in JavaScript.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 08-28-2010, 12:49 AM   PM User | #5
jan lee
New Coder

 
Join Date: Aug 2010
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
jan lee is an unknown quantity at this point
Well, well, well, the first step is done. I would need now a bit help to reset the textarea contents evey time that change the text placed on it.

I am trying the following:

Quote:
<textarea onchange="document.getElementById('fred').value=''";>
Quote:
<textarea onfocus="document.getElementById('fred').value=''";>
input submit

Quote:
document.getElementById('fred').value="";
Regards

Jan Lee
jan lee is offline   Reply With Quote
Old 08-28-2010, 12:59 AM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Sorry, don't understand.

Looks to me like onchange would be what you want, but why do you want to ONLY set the value of 'fred' to blank and nothing more?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 08-28-2010, 01:14 AM   PM User | #7
jan lee
New Coder

 
Join Date: Aug 2010
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
jan lee is an unknown quantity at this point
Hi

"fred" is the id of the textarea. No forms. It works fine no forms.

The web page is placed on the iframe and automatically the source code is shown inside the textarea. No problems. I have the script to strip out the source code! My problem is "reset" the "source code" before a new page is placed on the textarea. Press the button? No. Any pressed button.

Regards

JanLee
jan lee is offline   Reply With Quote
Old 08-28-2010, 01:24 AM   PM User | #8
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Why not use the same button that you press to *get* the next URL to clear the textarea?

Or if you are using a timer, just have it clear the textarea at the same time it starts the reload of the <iframe>.

Not clear to me why you need the textarea if you have the <iframe>, but never mind.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
jan lee (08-28-2010)
Old 08-28-2010, 01:50 AM   PM User | #9
jan lee
New Coder

 
Join Date: Aug 2010
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
jan lee is an unknown quantity at this point
Ok.

Following your advice I found the exact position in the script to put the command line to reset the textarea.

Regards

Jan Lee
jan lee is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:42 PM.


Advertisement
Log in to turn off these ads.