/    Sign up×
Community /Pin to ProfileBookmark

Java call= google to open on same page with lytebox

Hello all,
I hope someone can help me with this problem I have, I found this code snippet on the net but can’t get it to work the way I want it to.

Using the below script will open google on another page & I want it to open on the same page in a lytebox.

[code=php]<script type=”text/javascript”>
<!–
function myPopup() {
window.open( <a
rev=”width: 400px; height: 300px; scrolling: no;”>http://www.google.com</a> )
}
//–>
</script>[/code]

This is the button command used to call it up.
<input type=”button” onClick=”myPopup()” value=”Google”>

I don’t need to use the width & height that is seen above, as this can be done from the lytebox CSS, but for some reason can’t remove it, If I do the button won’t work? If I try to add rel=”lyteframe” to the above it won’t work either.

This is the original code from the lytebox site, but it didn’t call up google for me, just an error

[code=php]<a href=”http://www.google.com” rel=”lyteframe” title=”Search Google”
rev=”width: 400px; height: 300px; scrolling: no;”>Google Search</a>[/code]

If someone can help, it would be much appreciated.

Chri5

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@FangSep 21.2010 — window.open will work without Lytebox. If you require a Lytebox in a popup window then all Lytebox scripts must be included in the popup document. This seems a little pointless as the 'grey area', which hides the rest of the document, will not be seen.

The 2nd example does work. There is probably another error in your document preventing this.
Copy linkTweet thisAlerts:
@Chri5authorSep 21.2010 — Thanks for the reply Fang,

I'm only using the google link as an example in this thread, using the below example will open google as a full page, no problem.
[code=php]<script type="text/javascript" language="javascript" src="lytebox.js"></script>
<link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />
<script type="text/javascript">
<!--
function myPopup(){
window.location = href="http://google.com"
}
//-->
</script>[/code]


However, I need to have the link I want to use in an anchor like below
[code=php]<a href="http://www.google.com" rel="lyteframe" title="Search Google"
rev="width: 400px; height: 300px; scrolling: no;">Google Search</a>
[/code]

But as soon as I add the above to the javascript it will not call google up, I just get object not found! error 404 & in the browser bar it show like this h**p://192.168.1.5/forum/Ipb3.1.2/Google Search, which is the location to my Ipb test board that I'm working on, I also don't need the title="Search Google" becouse it is being called up via this button. [code=php]<a><input type="button" onClick="myPopup()" value="Google Search"></a>[/code]

If I add the rel="lyteframe" like this href=" h**p://google.com rel="lyteframe"

the button will not call google up @all.

Hope this gives you a clearer picture of my problem, as you can tell I'm a noob @ javascript.

Regards

Chri5
Copy linkTweet thisAlerts:
@FangSep 22.2010 — But as soon as I add the above to the javascript it will not call google[/QUOTE]
If you are adding links through JavaScript, then you must run the Lytebox initialization script after doing this.
Copy linkTweet thisAlerts:
@Chri5authorSep 22.2010 — How would I go about doing this Fang, I havent a clue!!

It's well over my head mate.:eek:
Copy linkTweet thisAlerts:
@FangSep 22.2010 — [CODE]// insert link
document.getElementById('foo').innerHTML = '<a href="http://www.google.com" rel="lyteframe" title="Search Google" rev="width: 400px; height: 300px; scrolling: no;">Google Search</a> ';
// initialize Lytebox;
initLytebox();[/CODE]
Copy linkTweet thisAlerts:
@Chri5authorSep 22.2010 — If It's supposed to be added like this then it did'nt work?

You have a Pm Fang
[code=php]<script type="text/javascript">
<!--
function myPopup(){
document.getElementById('foo').innerHTML = '<a href="http://www.google.com" rel="lyteframe" title="Search Google" rev="width: 400px; height: 300px; scrolling: no;">Google Search</a> ';
// initialize Lytebox;
initLytebox();
}
//-->
</script> [/code]
×

Success!

Help @Chri5 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.11,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...