jonnyfb
asked on
Load a page into another frame
Here is my HTML code
<script src="codepage.js" language="Javascript" type="text/javascript"></s cript>
<iframe src="blankpage.htm" width="88" height="32"></iframe>
I need codepage.js to load this page into the iframe:
counter.asp?referer=REFERE R GOES HERE
I know this may seem simple to most of you but I am a beginner to JS!
Thanks for reading this.
<script src="codepage.js" language="Javascript" type="text/javascript"></s
<iframe src="blankpage.htm" width="88" height="32"></iframe>
I need codepage.js to load this page into the iframe:
counter.asp?referer=REFERE
I know this may seem simple to most of you but I am a beginner to JS!
Thanks for reading this.
ASKER
Is there any way which I can redirect to counter.asp?userid=...&cou ntid=...&r eferer=...
If I make the script name: code.js?userid=...&countid =...
Thankyou
If I make the script name: code.js?userid=...&countid
Thankyou
You cannot read the script script src in the script and you cannot change it dynamicaly.
Where should the values come from?
Where should the values come from?
ASKER
Isnt there a querystring object?
The name of querystring object is: windows.location.search
And the syntax to pass the query string to the iframe is:
window.onload=function(){w indow.fram es.myFrame .src="coun ter.asp?re ferer="+do cument.ref errer+"&"+ windows.lo cation.sea rch.substr (1)};
window.onload=function(){w
ASKER
Sorry I havent replied for soooo long. Would
windows.location.search.su bstr(1)
be the whole querystring?
windows.location.search.su
be the whole querystring?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why the grading B???
ASKER
Cause it diddnt work!
ASKER
My Iframe is still just blank!
You did not state that. You simple closed the question.
I have a solution for you.
I have a solution for you.
ASKER
I did not want to waste your time.
Sorry, could you tell me?
Sorry, could you tell me?
Could you ask for grade correction here:
https://www.experts-exchange.com/Community_Support/
And you do not waste my time. I like answering questions ;-)
https://www.experts-exchange.com/Community_Support/
And you do not waste my time. I like answering questions ;-)
ASKER
If I correct the grade, will you give me the solution?
My script line has two typos.
Take this one:
window.onload=function(){w indow.fram es.myFrame .location= "counter.h tm?referer ="+documen t.referrer +"&"+windo w.location .search.su bstr(1)};
Take this one:
window.onload=function(){w
ASKER
Ill test it now!
ASKER
I made counter.asp write the querystring and it said:
referer=&
So something must be wrong with window.location.search.sub str(1)
referer=&
So something must be wrong with window.location.search.sub
That's correct.
You cannot use document.referrer localy, only on web server.
And if you want to avoid the & char when no query was in parnet window, then you need and "if" statement. But that does not hurt in standard URL syntax.
If you realy want the & only when query are passed, then rewrite it to this:
window.onload=function(){w indow.fram es.myFrame .location= "counter.h tm?referer ="+documen t.referrer +((window. location.s earch)?"&" +window.lo cation.sea rch.substr (1):"")};
You cannot use document.referrer localy, only on web server.
And if you want to avoid the & char when no query was in parnet window, then you need and "if" statement. But that does not hurt in standard URL syntax.
If you realy want the & only when query are passed, then rewrite it to this:
window.onload=function(){w
ASKER
Ill try it.
ASKER
Oh no! I think Ive explained a bit wrong!!
I want this querystring:
<script src="codepage.js? >>>>>userid=...&countid=.. .<<<<<" language="Javascript" type="text/javascript"></s cript>
I want this querystring:
<script src="codepage.js? >>>>>userid=...&countid=..
ASKER
Im going now but I will be back later to check what help you have given. PLZZZ I am desperate!
<iframe name="myFrame" src="blankpage.htm" width="88" height="32"></iframe>
Then your script file needs this statement:
window.onload=function(){w