How to construct URL that calls javascript and loads .html file
Hi,
does anyone know how to create an URL string (Web properties/Link tab/Link to web address -field) that would run Covoxer's myOpen/Close script and simultaneously load a .html file to a iFrame that sits on a popup layer which is shown by Covoxer's script?
I know that the iFrame has to be uniquely named so that it can be targeted in the URL, but the rest is beyond me.
Re: How to construct URL that calls javascript and loads .html file
It may look like this:
Code:
javascript:document.getElementById("iframename").src="newurl";my_open("popup")
where:
iframename - iframe ID (set as: <iframe id="iframename"></iframe>);
newurl - link to the file that has to be open in iframe;
popup - popup to open (for Locking popups tweak).
The "The Open link in" feld in the Link tab has to be set to "Not specified" or "Same frame".
Re: How to construct URL that calls javascript and loads .html file
Well looking at that it is no wonder I couldn't make that on my own.
Thanks John! :)
Re: How to construct URL that calls javascript and loads .html file
Sorry John, I have to ask this...
Is it possible to add regular my_open/_close javascript calls in addition to the example you provided? In other words the link should do the main thing which is open popup layer, load URL into iFrame, and at the same time open/close a few popup layers.
Re: How to construct URL that calls javascript and loads .html file
Yes you can. Separate them with semicolons as usually.
Re: How to construct URL that calls javascript and loads .html file
Quote:
Originally Posted by
covoxer
Yes you can. Separate them with semicolons as usually.
Sorry but if anone could post some more sample code it would be very helpful to all the javascript noobies like me. The ealier post above (post #2) was great and I could follow that. Hopefully somebody can create a similar post showing it plus the part that would close those other popups that Markku notes.
Regards, Ross
Re: How to construct URL that calls javascript and loads .html file
Ok. Here's the one that loads page1.htm to the iframe, closes "popup1" and "popup3" and opens "popup2" and "popup4":
Code:
javascript:document.getElementById("iframename").src="page1.htm";my_close("popup1");my_close("popup3");my_open("popup2");my_open("popup4")
As you see, all the commands like "my_open("popup2")" are separated with semicolons.
You can also add any other JS statements in the same manner. Fo example, following will load iframe, open popup and show you a message:
Code:
javascript:document.getElementById("iframename").src="page1.htm";my_open("popup2");alert("Well done!!!")
Also note that commands are excuted in the order they are added to this string.
Re: How to construct URL that calls javascript and loads .html file
Could be my mistake again, but I cannot get this to work with IE7.
Should it?
Re: How to construct URL that calls javascript and loads .html file
Quote:
Originally Posted by
Markku
Could be my mistake again, but I cannot get this to work with IE7.
Should it?
What exactly doesn't work? Does iframe change it's content? Do popups open/close? Or nothing happens at all?... Or error message pops up? :confused:
Re: How to construct URL that calls javascript and loads .html file
Too little information on my behalf, sorry.
The iFrame does not load the .htm file. The popup works fine.