need help with an html code

They have: 18 posts

Joined: Mar 2003

I want to be able to have banners set up so that when someone clicks on them it not only opens a new window but also take them to another page in my site. In other words, for them to view the content of one my pages, they would have to click on a banner. Can this be done? If so, what is the html code?

mmi's picture

They have: 457 posts

Joined: Jan 2001

hey Picks2Play - yes, this is easily done, but I believe it involves javascript, not just html -
(there may be other ways of doing this, dunno)

here's a function I use to open more than one window on mmy site:

function hotlinks(URL) {
   window.open(URL,'hotlinkswin','location=yes,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=645,height=390,screenX=20,screenY=20,left=20,top=20');}
'the html I use is something like this:<a HREF="javascript: hotlinks('http://www.essential.org/')">Essential Information</a>'I can't say how banners might complicate this - dunno anything about 'em

you should be able to easily find tutorials about this online if mmy example isn't useful or clear


Web Xpertz Community Forums for Webmasters & Developers

Where You Can Learn, Advise, and Have Fun in the Process

They have: 18 posts

Joined: Mar 2003

mmi, all thanks for helping me out. You probably figured out that i'm a rookie so It might sound dumb but do I have to use both codes you mentioned or just the 2nd one?

They have: 18 posts

Joined: Mar 2003

I have no clue how javascript works!

mmi's picture

They have: 457 posts

Joined: Jan 2001

ya need both - the js goes in yer page's head and the html in the body

don't hesitate to post back with Q's; everybody learned at some point - but I figure you make better progress by using tutorials (either online or from books) and then asking for help when ya get stuck

clueless, eh? Wink - I'm gonna risk getting in trouble by pointing you to a set of js tutorials from mmy hometown

http://www.pageresource.com/jscript/

this might open some, ah ..., windows for ya Cool


Web Xpertz Community Forums for Webmasters & Developers

Where You Can Learn, Advise, and Have Fun in the Process

They have: 18 posts

Joined: Mar 2003

Thanks!! will use them and then get back on here if I get stuck!!

mmi's picture

They have: 457 posts

Joined: Jan 2001

hey P2P

there are a couple of problems with the code I put up - maybe I can help unstick ya before ya get there Wink

1) when ya post scripts onto a site like this, they're typically modified so bad things don't/can't happen -
the server adds some spaces so scripts can't be executed - something like that -
I repaired the one in the html, but not the one in the script - hmmm, the server's defences seem
to be resistant to this fix - you need to delete the space in "window. open"

2) some scripts (or parts of them) need to be on one line of code to operate - you need to eliminate
the break in the line beginning "window"

3) browsers require <script> tags in order to recognize js - I didn't put those in

soooo, let's try this again Cool

<head>

&lt;script LANGUAGE="javaScript" TYPE="text/javascript"&gt;

function hotlinks(URL) {
   window.open(URL,'hotlinkswin','location=yes,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=645,height=390,screenX=20,screenY=20,left=20,top=20');}

&lt;/script&gt;

</head>

<body>

<a HREF="javascript: hotlinks('http://www.essential.org/')">Essential Information</a>

</body>
'I think modern browsers don't require the HEAD and BODY tags, but I've included them so you'll know where things go

the way this script is written allows you to code the html for more than one popup a little more economically -
I wanna give you another example of a way to write this which may more closely match others you're
likely to find - it's at http://ememi.com/tmp/popup.html

now get poppin' Smiling


Web Xpertz Community Forums for Webmasters & Developers

Where You Can Learn, Advise, and Have Fun in the Process

They have: 344 posts

Joined: Jun 2002

Why not simply use:

target="_new"'

It opens a new window and is easy to remember and implement.

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Because he wants to not only open up a link to another site in a new window but also change the page on his own site in the existing window.

They have: 344 posts

Joined: Jun 2002

aah...well...you learn something new every day! Smiling

They have: 18 posts

Joined: Mar 2003

Hey mmi,

I went to the link you gave me (http://ememi.com/tmp/popup.html) and clicked on it and it opened a new window but the page did not go to another page.

Thanks anyways, I'll see if someone knows how to do that in other webmaster forums.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

zerocattle.com/examples/popUp.html

You have to name your window (the one before you popup one) -- then you can control the parent page from the popup or from the link that creates the popup.

What you would do is have another argument in your onclick function, one to popUp(); and then another to change the location.href of the parent page.

mmi's picture

They have: 457 posts

Joined: Jan 2001

hey - as Suzanne noted, in thisfunction openEastWindow() {eastWindow=window.open('east.doc','eastWin',...'you need to specify a document - something to replace "east.doc"

I was not in a position to identify the document on yer site that you want to open

sorry if I didn't make that clear Smiling


Web Xpertz Community Forums for Webmasters & Developers

Where You Can Learn, Advise, and Have Fun in the Process

They have: 18 posts

Joined: Mar 2003

I haven't been able to do this, can someone please post a sample code and I'll just replace with my information.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

To clarify, since you're having problems (per your PM) -- banner

Which will, ideally, pop the banner ad page into a new window and change your parent window to the right page.

In answer to your question about which part you need, please read the tutorials included in that link. In order to make this work as you intend it to (which is an interesting idea, but very easy to circumvent and won't work for people with JavaScript disabled), you'll need all parts of the script.

They have: 18 posts

Joined: Mar 2003

My home page where the banner will be at: index.html (website address: picks2play.com

Page that I want to change too upon banner click: freepicks.html

New window will open upon clicking on the the Pay-per-click banner. Here's the code:

Ok, now what goes where?

banner

"whatever.html" What Goes here?
'whatever.html' What Goes here?

etc. etc.

Thanks!!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You don't have control over the new window, since it's for the advertiser's site, right?

You won't get click-throughs if you have the banner go to your page then spawn a new window onLoad.

So, hmmm...

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Okay, here you go. The price is you have to buy the next person in line's coffee or meal or whatever. DON'T BE STINGEY or your karma will suck.

Basically, set the real page as the href and don't kill it with the "return" -- and you really should be reading those tutorials.

They have: 18 posts

Joined: Mar 2003

Suzanne,

Thanks for all your help. I just load it the code you gave me and the banner appeared and when I clicked on it, it changed to the page of my choice but a new window DID NOT pop-up (the one that's suppose to open up for the pay-per-click site)

Actually, Let me know where I can send you a little something for helping!!

Smiling
(Paypal, StormPay, etc.)

They have: 18 posts

Joined: Mar 2003

Was I suppose to insert a javascript code like mmi said?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

no no, you must help someone else. that's how this works. otherwise you'd just hire me. Wink

yes, you'll need to have the JavaScript function (the one from my link?) in the head section of your page -- <script type="text/javascript" src="popup.js"></script> -- or have the script in your head tags as is --

<script type="text/javascript>
function popUp( blah blah
}
</script>

Can you follow that without explicit direction? The function (that opens the new window) has to be in the head element.

Or you can use mmi's javascript code instead of the function. It depends on whether you'll need to do this more than once or not on your page or on your site. If you'll use it more than one, using a function is better.

They have: 18 posts

Joined: Mar 2003

You are going to kill me Suzanne, still no pop-up window.

I created a test page, check it out: http://www.picks2play.com/testpage.html

View the source and please tell me what I did wrong or what I left out!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

The code looks fine, so you may want to upload that script, eh? Wink

http://www.picks2play.com/popup.js <-- 404

Download this and save it as popup.js to your own server:

http://www.zerocattle.com/scripts/popup.js

THEN it will work. Wink

They have: 18 posts

Joined: Mar 2003

I downloaded the popup.js to my computer and I know how to upload that from my desktop (right click on the shorcut icon & upload using my WS_FTP Upload Wizard) but how do I go about uploading that script <------- probably dumb question but what can I say...lol Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

oh boy. do you know how to use WS_FTP to connect directly to your website? Just like an .html file, you would upload the popup.js file.

They have: 18 posts

Joined: Mar 2003

Yes I do know how to upload using my WS_FTP, hard to believe huh?...lol

I uploaded the popup.js and now is working! Smiling

You are a class act, thanks a lot for all your help. I will gladly pay it forward!!

I wish nothing but the best to you and your love ones!!! Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Heh, glad it's all working. Wink

They have: 18 posts

Joined: Mar 2003

Also want to thank mmi Smiling

They have: 18 posts

Joined: Mar 2003

Suzanne, don't mean to bother you but I tried to see if it would also work for text links and it did except for this: Instead of the page changing and going to to one I assigned (freepick.html), it goes to my home page. Why is that?

I used the same one you gave me but took out the banner code and put the text instead:

Today's free pick

They have: 18 posts

Joined: Mar 2003

Nevermind, I just saw why -------> ("")freepicks.html"

had an extra (")

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.