Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-11-28 16:13:53
Point:500 Replies:7 POST_ID:828540USER_ID:11059
Topic:
Hypertext Markup Language (HTML);;JavaScript
I get one iframe in my body tag of my website html page. And I am trying to
change iframe.src's url for every 10 seconds to test iframe by javascript . I found that
during iframe.src's new content is loading, I could NOT do other thing outside of iframe area
For example, I could not click the href at <a> tag in the body tag or could Not click the refresh
button on IE .
So I think it might NOT be possible until or unless iframe content has been finished or loaded.
Please advise Is it possible I could do a link href click or do other operation on my webpage during iframe 's loading ?
Duncan
change iframe.src's url for every 10 seconds to test iframe by javascript . I found that
during iframe.src's new content is loading, I could NOT do other thing outside of iframe area
For example, I could not click the href at <a> tag in the body tag or could Not click the refresh
button on IE .
So I think it might NOT be possible until or unless iframe content has been finished or loaded.
Please advise Is it possible I could do a link href click or do other operation on my webpage during iframe 's loading ?
Duncan
///Just example<html><head>><script>function play(link){//alert(link); document.getElementById("myiframe").src=link;}function playstack() {var string=new Array();string[0]='http://www.att.com';string[1]='http://www.yahoo.com/';string[2]='http://www.intel.com/';string[3]='http://www.IBM.com/';string[4]='http://www.hsbc.com';string[5]='http://www.lenovo.com';string[6]='http://www.microsoft.com';string[7]='http://www.experts-exchange.com/';var i=0;var c=1;while (c < 17){(function(i){window.setTimeout(function() {play(string[i]);} , 10*1000*c);})(i);c=c+1;i=i+1;if (i==8) {i=0;}}</scipt><body onload="playstack();"><div><a href="http://www.mywebsite.com">Click testing during Iframe is changing src or url</a></div><div><IFRAME id="myiframe" style="border:0; margin:0; padding:0 " ;name='myiframe' noresize border=0 frameborder=0 width=200px height=500px src='blank.html' ></IFRAME></div></body></html> 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40:41:42:43:
Author: duncanb7 replied at 2024-12-23 09:54:49
Dear Suport,
I already reply these qeustion and award the point out, Why
it still complaint I am not answering the question. Please advise
Duncan
I already reply these qeustion and award the point out, Why
it still complaint I am not answering the question. Please advise
Duncan
Author: duncanb7 replied at 2024-12-23 09:32:49
Thanks for your reply, now feel better after
go through w3schools tutorial
go through w3schools tutorial
Assisted Solution
Expert: Eyal replied at 2024-11-30 11:14:31
167 points GOOD
setInterval will never stop and continue looping until clearInterval is called
http://www.w3schools.com/jsref/met_win_setinterval.asp
settimeout is the same but ends after one time
http://www.w3schools.com/jsref/met_win_settimeout.asp
each time the code will executed ++i will happen (this increments the I parameter)
http://www.w3schools.com/jsref/met_win_setinterval.asp
settimeout is the same but ends after one time
http://www.w3schools.com/jsref/met_win_settimeout.asp
each time the code will executed ++i will happen (this increments the I parameter)
Author: duncanb7 replied at 2024-11-30 05:35:02
Sorry one more question,
1-it seems setinterval() is never stopped since i is non-stop to increase,right?
2-and probably using setTimeout() instead of setinterval can the same effect, Right ?
3-How Jquery will know it will loop function for i ? and all Jquery function can do loop function
such as the setInterval() ?
Please advise, Duncan
setInterval(function () {
$(iframe).attr('src', locations[++i % len]);
}, 30000)
1-it seems setinterval() is never stopped since i is non-stop to increase,right?
2-and probably using setTimeout() instead of setinterval can the same effect, Right ?
3-How Jquery will know it will loop function for i ? and all Jquery function can do loop function
such as the setInterval() ?
Please advise, Duncan
setInterval(function () {
$(iframe).attr('src', locations[++i % len]);
}, 30000)
Assisted Solution
Expert: Eyal replied at 2024-11-29 22:05:15
166 points GOOD
correct. because there is a timer and we always incrementing the i parameter by 1 we must take care the value will stay in the range of the array and we done so by using the % operator
Author: duncanb7 replied at 2024-11-29 12:13:24
Thanks for your reply, it seems that is improving a little but but not prefect the code
is similar to use document.complete. Is it that right ?
Any could you tell me what is % in $(iframe).attr('src', locations[++i % len]);
In javscript, % means Modulus (division remainder). Is the same as your % in jquery code?
is similar to use document.complete. Is it that right ?
Any could you tell me what is % in $(iframe).attr('src', locations[++i % len]);
In javscript, % means Modulus (division remainder). Is the same as your % in jquery code?
Accepted Solution
Expert: Eyal replied at 2024-11-28 21:45:59
167 points GOOD
see if this helps you in some way
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script> $(document).ready(function(){ var locations = ["http://webPage1.com", "http://webPage2.com"]; var len = locations.length; var iframe = $('#frame'); var i = 0; setInterval(function () { $(iframe).attr('src', locations[++i % len]); }, 30000); }); </script> </head> <body> <iframe id="frame"></iframe> </body></html> 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:
if it didn't try doing Ajax call to get content and then push it to the iframe like shown in the below link
http://twigstechtips.blogspot.com/2011/02/jquery-set-content-of-empty-iframe.html