Forum Moderators: open

Message Too Old, No Replies

Pop up Window

         

Magpie

10:26 pm on Apr 1, 2004 (gmt 0)

10+ Year Member



Hey!

On my website when you load the main page, I have it so a pop up window comes up with a picture advertising my bands next show... this is the script I used

<script language="JavaScript" for="window" event="onload()">
<!--
window.open("http://urlofpic.jpg","vb","height=330,width=248")
//-->
</script>

Now it works fine... but there are spaces around the picture... how do i make it so that the box comes out the size of the picture... i tried resizing it useing the:

height=330,width=248 code...

but it just cuts off the picture.

All help is much appreciated

Kind Regards

Martin

birdbrain

9:09 am on Apr 2, 2004 (gmt 0)



Hi there Magpie,

The secret is to put the image in an .html file like this..


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>The Image</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<style type="text/css">
/*<![CDATA[*/
body
{
margin:0;
}
/*//]]>*/
</style>

</head>
<body>
<div>
<img src="your_image.jpg" alt="your_image" width="248" height="330" border="0"/>
</div>
</body>
</html>

birdbrain

Magpie

9:31 am on Apr 2, 2004 (gmt 0)

10+ Year Member



How do I do that... I mean, all my pages are saved as .htm do i just save it in one of them?

Magpie

birdbrain

10:12 am on Apr 2, 2004 (gmt 0)



Hi there Magpie,


How do I do that... I mean, all my pages are saved as .htm do I just save it in one of them?

No, you use the new .html file that I made [ let's name it my_image.html ] and contains just the
image that this script is calling...


<script language="JavaScript" for="window" event="onload()">
<!--
window.open("http://urlofpic.jpg","vb","height=330,width=248")
//-->
</script>


Now change that part of the script in bold to this...


<script language="JavaScript" for="window" event="onload()">
<!--
window.open("http://yoursite/my_image.html","vb","height=330,width=248")
//-->
</script>

I hope that this makes sense ;)

birdbrain

Magpie

10:19 am on Apr 2, 2004 (gmt 0)

10+ Year Member



im still a bit confused as to if i need to create a new page with that picture in it. coz im not in .html i have .htm or are they the same thing

and also exactly the script that goes inplace of what i already have

Cheers

Martin

Magpie

10:27 am on Apr 2, 2004 (gmt 0)

10+ Year Member



I tried creating a seperate page and it still didnt work... when i resise it to the image it cuts off the picture.

Do i need to use any of the code u posted previously at the top?

birdbrain

11:08 am on Apr 2, 2004 (gmt 0)



Hi there Magpie,

Here, again, is the page that you use
I will even put your image in ;)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>The Image</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<style type="text/css">
/*<![CDATA[*/
body
{
margin:0;
}
/*//]]>*/
</style>

</head>
<body>
<div>
<img src="urlofpic.jpg" alt="urlofpic" width="248" height="330" border="0"/>
</div>
</body>
</html>

Now 'copy & paste' this and save it as urlofpic.htm

Here is the script to call this file...


<script language="JavaScript" for="window" event="onload()">
<!--
window.open("urlofpic.htm","vb","height=330,width=248")
//-->
</script>

If the image dimensions, that I have used, are correct...
do not change anything. It will work in I.E. Netscape 7 and
Mozilla firefox 0.8

birdbrain

Magpie

1:04 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



ok done all that now all it brings up is a box saying

"html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

no picture

------------------------------------------------------

this is the script i have put in:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
"html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Borderline</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<style type="text/css>
/*<![CDATA[*/
body
{
margin;0:
}
/*//]]/*/
</style>

</head>
<body>
<div>
<img src="URL of the picture" alt="Name of picture" width="248" height="330"border="0"/>
</div>
</body>
<html/>

birdbrain

1:38 pm on Apr 2, 2004 (gmt 0)



why have you removed the < from ...
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

[edited by: birdbrain at 4:02 pm (utc) on April 2, 2004]

Magpie

1:41 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



i changed that and the page is still showing this:

<"html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

this is the exact script i have used

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<"html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Borderline</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<style type="text/css>
/*<![CDATA[*/
body
{
margin;0:
}
/*//]]/*/
</style>

</head>
<body>
<div>
<img src="http://www.underjudgement.com/images/Borderline.jpg" alt="Borderline" width="248" height="330"border="0"/>
</div>
</body>
<html/>

------------------------------------------------------

And on the page where the pop up occurs i have this:

<script language="JavaScript" for="window" event="onload()">
<!--
window.open("http://www.underjudgement.com/borderline.htm","vb","height=330,width=248")
//-->
</script>

Magpie

3:34 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



If you got to:

[underjudgement.com...]

you'll get the pop up and you'll see that the image has big borders and when i resise the window to fit the image, the borders star but it cuts the picture off from the bottom right.

Thanks

Martin

birdbrain

4:25 pm on Apr 2, 2004 (gmt 0)



Hi there Magpie,

This is getting silly ;)

this line needs the added " removed...

<"html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

thus...

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

this line needs the removed " added...

<style type="text/css>

thus...

<style type="text/css">

this is...
borderline.htm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Borderline</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />


<style type="text/css">
/*<![CDATA[*/
body
{
margin:0;
}
/*//]]/*/
</style>


</head>
<body>
<div>
<img src="http://www.underjudgement.com/images/Borderline.jpg" alt="Borderline" width="248" height="330"border="0"/>
</div>
</body>
</html>

this is the...
script


<script language="JavaScript" for="window" event="onload()">
<!--
window.open("http://www.underjudgement.com/borderline.htm","vb","height=330,width=248")
//-->
</script>

Save the borderline.htm correctly ;) and it will work ;)

birdbrain

[edited by: birdbrain at 7:16 pm (utc) on April 2, 2004]

Magpie

5:02 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



Right I have done exactly what you have said... I have keyed in all the code correctly and into the right pages.

and the same thing happens. Here is the link to the outcome.

[underjudgement.com...]

If you see, when the pop up comes up, the picture is still getting cut off and there are still boarders around the top and the left of the picture

What am i doing wrong... I do agree this is getting very silly :-(

lol

I appreciate all your help

Martin

birdbrain

7:34 pm on Apr 2, 2004 (gmt 0)



Hi there Magpie,

I have got it nailed ;)
There is one more typo, I have found, that
was not in my original...

<style type="text/css">
/*<![CDATA[*/
body
{
margin:0:
}
/*//]]/*/
</style>


Remove the colon : from after the 0
and replace it with a semi colon ;
you can even leave it out altogether

so...

<style type="text/css">
/*<![CDATA[*/
body
{
margin:0
}
/*//]]/*/
</style>

;) ;) ;)

birdbrain

Magpie

1:03 am on Apr 3, 2004 (gmt 0)

10+ Year Member



IT WORKED!

THANK F*** FOR THAT... lol

Thank you ever so much... I really appreciate it... It's amazing what one TINY little alteration of adding a simple ';' or taking it away can do.

You've made my day mate.

Thanks again

Kind Regards

Martin

Magpie

8:08 am on Apr 3, 2004 (gmt 0)

10+ Year Member



One more question :-P

How do I go about changing the Title on the top of the pop up window?

Cheers

Martin

birdbrain

10:50 am on Apr 3, 2004 (gmt 0)



Hi there Martin,

If you do not use the full 'URL'
in the javascript you should get
'borderline' to appear in the
'Title Bar'...


<script language="JavaScript" for="window" event="onload()">
<!--
window.open
("borderline.htm","vb","height=307,width=230")
//-->
</script>

;) ;)

birdbrain

Magpie

2:08 pm on Apr 3, 2004 (gmt 0)

10+ Year Member



Cheers for that... But is there any way I can get it to say 'Next Gig' instead of the URL using javascript

Thanks again

Martin

birdbrain

2:53 pm on Apr 3, 2004 (gmt 0)



Hi there Martin,

'But is there any way I can get it to say 'Next Gig' instead of the URL using javascript'

Yes, as I said before change...


<script language="JavaScript" for="window" event="onload()">
<!--
window.open
("http://www.underjudgement.com/borderline.htm","vb","height=307,width=230")
//-->
</script>

to this...


<script language="JavaScript" for="window" event="onload()">
<!--
window.open
("borderline.htm","vb","height=307,width=230")
//-->
</script>

and then in borderline.htm change ...


<title>Borderline</title>

to this...


<title>Next Gig</title>

;) ;)

birdbrain

Magpie

3:25 pm on Apr 3, 2004 (gmt 0)

10+ Year Member



I done that and it didn't make a difference... The pop up window still comes up with the URL at the top of the window (where the minimise and close buttons are)

this is the code i used:

Borderline.htm:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Next Gig</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<style type="text/css">
/*<![CDATA[*/
body
{
margin:0
}
/*//]]/*/
</style>

</head>
<body>
<div>
<img src="http://www.underjudgement.com/images/Borderline.jpg" alt="Borderline" width="230" height="307"border="0"/>
</div>
</body>
<html/>

------------------------------------------------------

and the script:

<script language="JavaScript" for="window" event="onload()">
<!--
window.open
("borderline.htm","vb","height=307,width=230")
//-->
</script>

Cheers

Martin

Magpie

3:32 pm on Apr 3, 2004 (gmt 0)

10+ Year Member



Ok i think i sorted it:

i changed the code to this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Borderline</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<style type="text/css">
/*<![CDATA[*/
body
{
margin:0
}
/*//]]/*/
</style>

<title>Borderline</title>

</head>
<body>
<div>
<img src="http://www.underjudgement.com/images/Borderline.jpg" alt="Borderline" width="230" height="307"border="0"/>
</div>
</body>
<html/>

------------------------------------------------------

I added the:
<title>Borderline</title>
inbetween the style and the head... it was a lucky guess really tho lol... This is the correct way of ding it yes?

Cheers for everything... Keep an eye on this post... no doubt ill be askin somin agen on the same topic lol

Martin

birdbrain

10:06 pm on Apr 4, 2004 (gmt 0)



Hi there Martin,

I discovered that the code did not work
in 'Opera' browsers with just margin:0.
To get it to render correctly in that browser
you need to add padding:0
so...


<style type="text/css">
/*<![CDATA[*/
body
{
margin:0;
padding:0;
}
/*//]]/*/
</style>


;) ;)

birdbrain