473,542 Members | 7,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Webpage does not resume lhtml loading if JS operates.

JS

Dear Group,
I have a webpage of small images. At the bottom is a Javascript
function. If someone scrolls impatiently to the function link, when
the action is complete the html does not continue loading the images.
How is this situation best dealt with?
Thank you for any assistance you can offer.
JS

Jul 23 '05 #1
11 1703
On Sun, 10 Oct 2004 12:46:42 GMT, <JS@yahoo.com> wrote:
I have a webpage of small images. At the bottom is a Javascript
function. If someone scrolls impatiently to the function link, when the
action is complete the html does not continue loading the images.
How is this situation best dealt with?
Thank you for any assistance you can offer.


By "function link", do you mean

<a href="javascript:funcName()">...</a>

If so, please read the FAQ (<URL:http://jibbering.com/faq/>). If not,
please provide a better description, preferably illustrated with a small
snippet of code.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
JS
On Sun, 10 Oct 2004 12:56:40 GMT, "Michael Winter"
<M.******@blueyonder.co.invalid> wrote:
On Sun, 10 Oct 2004 12:46:42 GMT, <JS@yahoo.com> wrote:
I have a webpage of small images. At the bottom is a Javascript
function. If someone scrolls impatiently to the function link, when the
action is complete the html does not continue loading the images.
How is this situation best dealt with?
Thank you for any assistance you can offer.


By "function link", do you mean

<a href="javascript:funcName()">...</a>

If so, please read the FAQ (<URL:http://jibbering.com/faq/>). If not,
please provide a better description, preferably illustrated with a small
snippet of code.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Michael,
Thank you for the URL. I took the advice there and changed from
'javascript:some function()' to the onClick="some function" variation
with 'return false' to end. The browser returned to the image loading
successfully.
It has caused an unexpected side effect, in that the 'visited' links
no longer change color. I am using <STYLE type="text/css"> with
statements to set the font size, color, and decoration, but although
the hover works the visited no longer changes.
Is there a solution for this?
Thank you for your assistance.
JS

Jul 23 '05 #3
On Sun, 10 Oct 2004 16:04:12 GMT, <JS@yahoo.com> wrote:

[snip]
It has caused an unexpected side effect, in that the 'visited' links no
longer change color. I am using <STYLE type="text/css"> with statements
to set the font size, color, and decoration, but although the hover
works the visited no longer changes.
Is there a solution for this?


I can probably guess the cause, but it would be helpful to actually see
your code.

What is probably happening is that the URI specified by the link isn't
actually being visited as a result of user action. As such, the browser
doesn't have any reason to change the appearance of the link. A possible
solution is to add code to force the change through manipulation of inline
style information, or the class attribute of the A element. However,
without knowing what is causing the problem, it's hard to recommend
something.

Please either post a URI to an example, or post the relevant HTML and
(possibly) script code.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
JS
On Sun, 10 Oct 2004 16:32:05 GMT, "Michael Winter"
<M.******@blueyonder.co.invalid> wrote:
On Sun, 10 Oct 2004 16:04:12 GMT, <JS@yahoo.com> wrote:

[snip]
It has caused an unexpected side effect, in that the 'visited' links no
longer change color. I am using <STYLE type="text/css"> with statements
to set the font size, color, and decoration, but although the hover
works the visited no longer changes.
Is there a solution for this?


I can probably guess the cause, but it would be helpful to actually see
your code.

What is probably happening is that the URI specified by the link isn't
actually being visited as a result of user action. As such, the browser
doesn't have any reason to change the appearance of the link. A possible
solution is to add code to force the change through manipulation of inline
style information, or the class attribute of the A element. However,
without knowing what is causing the problem, it's hard to recommend
something.

Please either post a URI to an example, or post the relevant HTML and
(possibly) script code.

Mike

Mike,
Thanks for your welcome assistance.
The webpage has two IFrames, and clicking on one of many href links
fires the Javascript which loads a file into each. As I first
mentioned, the problem was that it did not return to downloading the
page images; otherwise, all OK.
Here is the BEFORE, and then AFTER the latest change scenaria.

BEFORE: <a href="javascript:change_frames('photo','text')">me </a><br>
AFTER: <a href="#" onClick="change_frames('photo','text'); return
false">me</a><br>

All other factors are unchanged. It does not matter if I use the URL
of one of the two files to be downloaded as the target of the href,
the link still does not change color on visit. The function is based
on 'inlineframe.location.href=photo+".jpg"; and similar for the text
file.
Thanks very much for your suggestions.
JS

Jul 23 '05 #5
JS
On Sun, 10 Oct 2004 19:01:27 GMT, JS@yahoo.com wrote:

SNIP>
Mike,
Thanks for your welcome assistance.
The webpage has two IFrames, and clicking on one of many href links
fires the Javascript which loads a file into each. As I first
mentioned, the problem was that it did not return to downloading the
page images; otherwise, all OK.
Here is the BEFORE, and then AFTER the latest change scenaria.

BEFORE: <a href="javascript:change_frames('photo','text')">me </a><br>
AFTER: <a href="#" onClick="change_frames('photo','text'); return
false">me</a><br>

All other factors are unchanged. It does not matter if I use the URL
of one of the two files to be downloaded as the target of the href,
the link still does not change color on visit. The function is based
on 'inlineframe.location.href=photo+".jpg"; and similar for the text
file.
Thanks very much for your suggestions.
JS


Mike,
I have just discovered that the link behaviour described in BEFORE
does not change in OPERA. It is therefore IE being obliging and
presumably contrary to standards compliance.
The question seems to be, then, how does one get the link to change
after onClick?
JS

Jul 23 '05 #6
On Sun, 10 Oct 2004 19:01:27 GMT, <JS@yahoo.com> wrote:

[snip]
BEFORE: <a
href="javascript:change_frames('photo','text')">me </a><br>
In case you're wonder what the actual problem was with this...

As you know, when a user clicks on a link, the browser attempts to
download the resource indicated by the URI. The browser's assumption is
that the resource will completely replace the current document (unless the
URI *is* the current document, of course), so most makes quite a sensible
decision: stop doing things. "Things" can be executing scripts, rendering
animation, or downloading data (such as images) for the now outgoing page.

As mentioned in the FAQ, the javascript URI scheme was originally intended
to do what a link normally does - replace the current page - so browsers
often act the same as they would with any other URI and stop what they
deem "pointless" activities.
AFTER: <a href="#"
onClick="change_frames('photo','text'); return false">me</a><br>


The link isn't marked as visited, because it already has been visited. The
URI refers to the current page so, if anything, the link should already be
rendered as you want.

A possible solution would be to add code to the click event listener that
manipulates the class attribute of the link. For example:

/* Script */
function markVisited(elem) {
elem.className = 'visited';
}
/* CSS Rule */
a:visited,
a.visited {
/* Set the color and background-color properties */
}

<a href="#"
onclick="markVisited(this);change_frames(....);ret urn false">

This will only be a temporary effect. If the page is reloaded, the
appearance will revert to how it was originally. If you already have class
attributes set on some of the links, you'll need to modify the markVisited
function (commented so you see what's happening):

function markVisited(elem) {
/* Get the current value of the class attribute and set the
* value that we're going to add.
*/
var cN = elem.className, v = 'visited';

/* If the className property isn't a string, then quit now: we
* can't do anything. If it is, check that we haven't already
* added the new string.
*/
if(('string' == typeof cN) && (-1 == cN.indexOf(v))) {

/* If the attribute already contains values, prepend a space
* before appending the new string.
*/
if(cN) {v = ' ' + v;}

/* Modify the attribute. Notice that we're now working on the
* real thing. The local variable was just for speed.
*/
elem.className += v;
}
}

However, you'll probably find that this won't result in a change as the
link should already be visited (as I said, the URI refers to the current
page). In such a case, the solution is to first set the link appearance to
the way you want when the page loads, then change it (as above), to the
visited appearance.

/* Call from the load event:
* <body onload="markVisited()">
*/
function markUnvisited() {
var a = document.links || [];
for(var i = 0, n = a.length; i < n; ++i) {
addClassValue(a[i], 'unvisited');
}
}

/* Call as in previous example. */
function markVisited(elem) {
addClassValue(elem, 'visited');
}

function addClassValue(elem, value) {
var cN = elem.className;

if(('string' == typeof cN) && (-1 == cN.indexOf(value))) {
if(cN) {value = ' ' + value;}
elem.className += value;
}
}
/* CSS Rules */
a:link,
a.unvisited {
/* Unvisited properties. */
}

a:visited,
a.visited {
/* Visited properties. */
}

All this is untested, by the way, so tell me if you have problems.

[snip]

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7
JS
On Sun, 10 Oct 2004 20:08:12 GMT, "Michael Winter"
<M.******@blueyonder.co.invalid> wrote:
On Sun, 10 Oct 2004 19:01:27 GMT, <JS@yahoo.com> wrote:

[snip]
BEFORE: <a
href="javascript:change_frames('photo','text')">me </a><br>


In case you're wonder what the actual problem was with this...

As you know, when a user clicks on a link, the browser attempts to
download the resource indicated by the URI. The browser's assumption is
that the resource will completely replace the current document (unless the
URI *is* the current document, of course), so most makes quite a sensible
decision: stop doing things. "Things" can be executing scripts, rendering
animation, or downloading data (such as images) for the now outgoing page.

As mentioned in the FAQ, the javascript URI scheme was originally intended
to do what a link normally does - replace the current page - so browsers
often act the same as they would with any other URI and stop what they
deem "pointless" activities.
AFTER: <a href="#"
onClick="change_frames('photo','text'); return false">me</a><br>


The link isn't marked as visited, because it already has been visited. The
URI refers to the current page so, if anything, the link should already be
rendered as you want.

A possible solution would be to add code to the click event listener that
manipulates the class attribute of the link. For example:

/* Script */
function markVisited(elem) {
elem.className = 'visited';
}
/* CSS Rule */
a:visited,
a.visited {
/* Set the color and background-color properties */
}

<a href="#"
onclick="markVisited(this);change_frames(....);ret urn false">

This will only be a temporary effect. If the page is reloaded, the
appearance will revert to how it was originally. If you already have class
attributes set on some of the links, you'll need to modify the markVisited
function (commented so you see what's happening):

function markVisited(elem) {
/* Get the current value of the class attribute and set the
* value that we're going to add.
*/
var cN = elem.className, v = 'visited';

/* If the className property isn't a string, then quit now: we
* can't do anything. If it is, check that we haven't already
* added the new string.
*/
if(('string' == typeof cN) && (-1 == cN.indexOf(v))) {

/* If the attribute already contains values, prepend a space
* before appending the new string.
*/
if(cN) {v = ' ' + v;}

/* Modify the attribute. Notice that we're now working on the
* real thing. The local variable was just for speed.
*/
elem.className += v;
}
}

However, you'll probably find that this won't result in a change as the
link should already be visited (as I said, the URI refers to the current
page). In such a case, the solution is to first set the link appearance to
the way you want when the page loads, then change it (as above), to the
visited appearance.

/* Call from the load event:
* <body onload="markVisited()">
*/
function markUnvisited() {
var a = document.links || [];
for(var i = 0, n = a.length; i < n; ++i) {
addClassValue(a[i], 'unvisited');
}
}

/* Call as in previous example. */
function markVisited(elem) {
addClassValue(elem, 'visited');
}

function addClassValue(elem, value) {
var cN = elem.className;

if(('string' == typeof cN) && (-1 == cN.indexOf(value))) {
if(cN) {value = ' ' + value;}
elem.className += value;
}
}
/* CSS Rules */
a:link,
a.unvisited {
/* Unvisited properties. */
}

a:visited,
a.visited {
/* Visited properties. */
}

All this is untested, by the way, so tell me if you have problems.

[snip]

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Thank you very much for your time and assistance with this Mike. It
will take me some time to develop and test it.
Regards
JS

Jul 23 '05 #8
JS
On Sun, 10 Oct 2004 20:08:12 GMT, "Michael Winter"
<M.******@blueyonder.co.invalid> wrote:
On Sun, 10 Oct 2004 19:01:27 GMT, <JS@yahoo.com> wrote:

[snip]

Mike,

I had an alternative approach which should work with little effort -
but after 4 hours I have serious doubts!
The plan: Use a plain html link to load a file into the first Iframe;
this preserves the link color change.
When the file loads, use it's onLoad to load the second Iframe.

In the absence of this I can put a link <a href="photo.jpg"
target="inlinefile">click</a> and this works fine. However, to get
this to work using the onLoad seems beyond me, for the javascript does
not apparently react to the target information. I would have thought
this was an elegant (simple) solution, but it has defeated me so far.
Any thoughts?
Thanks again
JS

Jul 23 '05 #9
On Sun, 10 Oct 2004 21:10:30 GMT, JS@yahoo.com wrote:
..It will take me some time to develop and test it.


Whereas it takes only moments to extract the 130 lines
of text no longer relevant to the reply.

Please trim unnecessary text in future.
<http://www.physci.org/rfc/rfc1855.jsp#3_1_1>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 23 '05 #10
On Mon, 11 Oct 2004 09:37:09 GMT, <JS@yahoo.com> wrote:

[snip]
When the file loads, use it's onLoad to load the second Iframe.
[snip]
However, to get this to work using the onLoad seems beyond me, for the
javascript does not apparently react to the target information.


To change the location of the second IFRAME from the first, you'd use:

parent.frames['frameName'].location = 'url';

What were you attempting to use?

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #11
JS
On Tue, 12 Oct 2004 09:51:15 GMT, "Michael Winter"
<M.******@blueyonder.co.invalid> wrote:

[SNIP}

To change the location of the second IFRAME from the first, you'd use:

parent.frames['frameName'].location = 'url';

What were you attempting to use?

[snip]

Mike

Mike,
My completely off-track attempt will go to my grave with me! The trick
of letting html deal with the link color while the onLoad loads the
second frame was a great success - entirely due to your help.
It works beautifully, and I am indebted to you.
Thank you for your kind assistance.
JS
Jul 23 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4280
by: John Whitmer | last post by:
I am trying to put together a web page to show remote users which PC's are available for RDP so they can use. The page work's fine except for when the goes to the pc to pull the info on if anybody is logged in or not it seems to have trouble. here is the blurb from the temp file that gets created on the webserver. "Error opening Terminal...
3
4929
by: Dave | last post by:
Hi, I have a C# program that is parsing an XML file and loading a database table. Some of the elements may be missing but I want to continue with loading the data anyway because they may not be applicable. So, if '190' doesn't exist using the following code: doc.SelectSingleNode("descendant::companyinfo
0
1124
by: mikelostcause | last post by:
Is there anyway to hold the base.WndProc(ref m) until after the Logout() finishes loading a webpage?? I'm working on shutting down an app that runs in the system tray, I have no problems shutting down, but I have problems saving data first. if the base.WndProc(ref m) is placed at the top, it closes, but the system does not continue to...
11
2965
by: Bob Hollness | last post by:
Hi all (me again. I do try to answer the posts I can instead of just asking!!!) Any ideas how I could load a webpage into a control that was about the size of a stamp? I tried a few things but it just put scrollbars on the control and showed the page as a whole. Basically, I want to scale an image of the webpage I guess. -- Bob...
0
929
by: Jim Hubbard | last post by:
One goal of my current project using the webbrowser control is to initially block activeX controls, pop-ups, javascript, vbscript and basically anything that isn't text or an image. But, I'd like to know that the web page loaded (or being loaded) requests the running of javascript or the showing of a pop-up or the loading of an activeX...
5
1502
by: Danny | last post by:
Hi, we have just uploaded our first APS.NET webpage some days ago. Now we had to notice that it takes soo long until the page is shown. About 15 seconds. First we thought, maybe it's because we have our clients in germany and the server is located in the USA. But this is not the reason, because the ping is ok.
14
1893
by: jim | last post by:
OK...Don't ask why - it'll just make ya mad. It makes me mad just thinking about it. I swear....if I didn't need this job, I'd tell 'em where to embed their webbrowser control. But, since I do need it, here are my questions... Can I embed an IE activex control in a webpage? I basically would like to be able to embed the same component...
7
9075
by: babacrash | last post by:
Hello, I have designed a webpage mainly consisting in JavaScript code. It has to load an XML document's content when it is loaded so as to show a content depending on the XML data. Both the HTML file and the XML file have to be stored locally on the computer and not on a server. I only test in Internet Explorer, and the behaviour is very...
14
2087
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I tried a google search but could not find anything. I am trying to cause one webpage to reload when a second web page is closed. The second webpage loads data into a session variable and when closed I need to reload the first page loading in the data from the session variable. Since I need to close the sescond form just setting the post...
0
7322
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7665
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5239
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3377
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.