View Full Version : linking question
mashnote
02-28-2002, 07:54 AM
I have a dynamic textbox on my mc's where i load external textfiles in.That's no problem.But my question is,can you make a pop-up window appear by clicking on a link in my textfile that i load into my textbox? I've go 'html' checked so i can link normal html-pages,but i can't seem to link pop-ups.
cheers
jimburton
02-28-2002, 08:17 AM
You can include a link to a javascript function in the dynamic text just like you would in a getURL, eg:
displayTxt = "Blah de blah. <b><a href='javascript:void(0);openWindow(\"myHTML.html\");'>click here to open window</a></b>.";
where openWin() is a javascript function in your html that looks like:
<script language="javascript">
function openWindow(url) {
if (window.open) {
window.open(url,"","width=300,height=300");
}
}
</script>
mashnote
02-28-2002, 08:41 AM
And if you want features like "scrolling=no" etc.. where should that be written ?
Thanx for superduper fast answer :)
I tried the code and i get an error. If i link to the html-file,it works,so it's no pathing issue...
jimburton
02-28-2002, 08:54 AM
Any attributes you want for your window go in the third argument of the open method - window.open(url,name,"width=n,height=n,scrollbars,menubar,location,toolb ar");
make sure there are no spaces in that list. For the ones that are either on or off there's no need to put scrollbars=yes - just include them in the list. Get a full list of possible attributes at www.devguru.com
Hope that helps
jimburton
02-28-2002, 08:56 AM
I tried the code and i get an error.
What's the error?
mashnote
02-28-2002, 11:13 AM
Sorry..long lunchbreak :)
when i use your code,i get a "cannot find server" and when i use this code :
//in the link
'javascript:window.open("myHTML.html","myWind","width=300,height=300,scrollbars=no,menubar=no,loca tion=no,toolbar=no");'
//in the html page
<script language="javascript">
function openWindow(url) {
if (window.open) {
window.open(url,name,"width=300,height=300,scrollbars=no,menubar=no,loca tion=no,toolbar=no);
}
}
</script>
i get the pop up,but the main page swithes to another blank page
tried everything
jimburton
02-28-2002, 11:33 AM
I'd personally prefer the function method because it's neater and reusable but you can do either. When you put the window.open() stright in the href link you need to start off with the void(0) keyword to stop the browser trying to load your javascript as a page.
If you stick with the function method you won't have this problem adn all you have to do is make sure you're passing the url properly - check that it's in quotes, as in:
<a href='javascript:void(0);openWindow(\"myHTML.html\");'>click here to open window</a>
notice that I've escaped the quotation marks with a backspace - this works for me...
mashnote
02-28-2002, 12:30 PM
Ii'll try that again,read it 10x,and post my results.
thanx for the explanation,not having a background in programming makes it all a bit ..you know..wowee..sometimes.
mashnote
03-01-2002, 08:28 AM
Nope,still not working,if i use void(0),nothing happens
And without void(0) the blank page keeps coming...:(
I changed and tried like..everything, i just dont get it
jimburton
03-01-2002, 08:37 AM
check this out mashnote - it's a working example. Start with the page Movie1JS.htm and also look at the fla......
mashnote
03-01-2002, 11:52 AM
Jim ,it works man !!! I'm so gratefull,really :D
You know,when confusion starts to set in,a cup of coffee and a helpfull .fla clear things up :)
Yet i still don't know exactly what the major difference is with what i've tried before ('cause it looks the same) But i really don't care for now.Enjoy the moment,hehe
Thanx again & take care
M
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.