14 replies [Last post]
rmcivo1
Offline
Enthusiast
Shropshire | Shrewsbury
Last seen: 10 years 4 weeks ago
Shropshire | Shrewsbury
Joined: 2003-12-05
Posts: 115
Points: 0

could anybody help with abit of javascript?

open_window() {
  setTimeout("window.open('http://www.google.co.uk', 'http://www.google.co.uk', 'scrollbars=0,resizable=0,height=120,width=170')',1000)"
  }
  
  </script>
</head>
<body <body onLoad="open_window()">

Doesnt do anything, anda window is supposed to load after 1 second?
Thanks

The Cyber World

Tags:
Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 day 5 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Pop up window?

Hi rmcivo1,
How are you calling it?

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 2 years 23 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Re: Pop up window?

rmcivo1 wrote:
could anybody help with abit of javascript?

open_window() {
  setTimeout("window.open('http://www.google.co.uk', 'http://www.google.co.uk', 'scrollbars=0,resizable=0,height=120,width=170')',1000)"
  }
  
  </script>
</head>
<body <body onLoad="open_window()">

Doesnt do anything, anda window is supposed to load after 1 second?
Thanks

Hi

The last line isn't valid:

You have:

<body <body onLoad="open_window()"> and it should be

<body onLoad="open_window()">

Trevor

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 day 5 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Pop up window?

Hi Trevor,
I completely missed the last line.
I must have my "see only valid code" glasses on Smile

rmcivo1
Offline
Enthusiast
Shropshire | Shrewsbury
Last seen: 10 years 4 weeks ago
Shropshire | Shrewsbury
Joined: 2003-12-05
Posts: 115
Points: 0

Pop up window?

Hiya sorry about this, I should have seen that :? There is another problem in the script somewhere, but I cannot see it?

  <script language="JavaScript">
  
  open_window() {
  setTimeout("window.open('http://www.google.co.uk', 'http://www.google.co.uk', 'scrollbars=0,resizable=0,height=120,width=170')',1000)"
  }
  
  </script>
</head>
<body onLoad="open_window()">

Thanks

The Cyber World

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 day 5 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Pop up window?

Hi rmcivo1,
Your quotes are wrong.

rmcivo1
Offline
Enthusiast
Shropshire | Shrewsbury
Last seen: 10 years 4 weeks ago
Shropshire | Shrewsbury
Joined: 2003-12-05
Posts: 115
Points: 0

Pop up window?

ooohhhhh, whoops sorry havn't got much experience in Javascript? I dont know which quotes? :?

The Cyber World

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 day 5 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Pop up window?

Hi rmcivo1,
If you look at the function you have a double quote inside setTimeout that is closed outside setTimeout.
I think you should be able to remove the double quotes altogether in this case.

Hope that helps

rmcivo1
Offline
Enthusiast
Shropshire | Shrewsbury
Last seen: 10 years 4 weeks ago
Shropshire | Shrewsbury
Joined: 2003-12-05
Posts: 115
Points: 0

Pop up window?

ok this is what I have now? but it doesnt seem to do anything Sad

  <script language="JavaScript">

  open_window() {
  setTimeout(window.open('comments_view.php', 'comments_view.php', 'scrollbars=0,resizable=0,height=120,width=170'),1000)
  }

  </script>
</head>
<body onLoad="open_window()">

Can anybody help?

The Cyber World

MalphasWats
Offline
Regular
Last seen: 14 years 24 weeks ago
Joined: 2004-03-22
Posts: 45
Points: 0

Pop up window?

try this:

<script language="JavaScript">

  function open_window() 
  {
    setTimeout("window.open('comments_view.php', 'Comments', 'scrollbars=0,resizable=0,height=120,width=170')",1000)
  }

</script>

</head>
<body onLoad="open_window()">

You hadn't declared open_window as a function.

http//www.michael-watts.com

"Never put your face in a bag of angry squirrels"

rmcivo1
Offline
Enthusiast
Shropshire | Shrewsbury
Last seen: 10 years 4 weeks ago
Shropshire | Shrewsbury
Joined: 2003-12-05
Posts: 115
Points: 0

Pop up window?

thanks for that guys, I think It was my web browser not allowing pop ups Sad not the code

Thanks again for you time and effort
Rees

The Cyber World

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 2 years 23 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Pop up window?

Hi

Ah, like Firefox etc block these by default?

Why not consider popping up a hidden div instead. Or similar. It would need javascript to be enabled, but doesn't fall foul of the po-up blockers.

Trevor

rmcivo1
Offline
Enthusiast
Shropshire | Shrewsbury
Last seen: 10 years 4 weeks ago
Shropshire | Shrewsbury
Joined: 2003-12-05
Posts: 115
Points: 0

Pop up window?

oh cool, how would that work? sorry to be a pain Sad

The Cyber World

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 2 years 23 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Pop up window?

Hi

As a demo only, see the ? buttons next to the form elements on this page. See the ones next to the dropdowns marked sidebar intrudes ... about halfway down. As you can see, you can put html in here, as I did with this image.

http://207.44.137.103/pagemaker_form.php

I used DOM Tooltips from freshmeat, but I had to mod the code to get it working how I wanted it.

Trevor

Fruitcake
Offline
Enthusiast
Perth, Australia
Last seen: 13 years 2 weeks ago
Perth, Australia
Timezone: GMT+8
Joined: 2004-04-12
Posts: 257
Points: 0

Pop up window?

If you want your page to validate, don't forget to make the onload attribute all lowercase Smile

I am Dan, Dan I am.