TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,230
  • Total Topics: 21,353
  • Online today: 446
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 177
  • Total: 178
  • lurkalot

javascript on portal block

Started by lyer, July 27, 2009, 06:03:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lyer

smf 1.1.9
tinyportal v1.0 beta 4

I use this code in the <head>

<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
  newwindow=window.open(url,'name','height=400,width=200');
  if (window.focus) {newwindow.focus()}
}
// -->
</script>


i put this in tinyportal block in right panel using HTML & Javascript code

<a href="javascript:poptastic('poppedexample.html');">Pop it</a>

tinyportal block doesnt call this code..what is the caus of the problem?

Zetan

Looks like you are trying to use some sort of Popup window?

Have a look here:
http://www.tinyportal.net/index.php?topic=29849.0

It might do what you need, or you might get an idea of whats wrong with the one you want to use.

lyer

#2
Quote from: Zetan on July 27, 2009, 08:37:27 AM
Looks like you are trying to use some sort of Popup window?

Have a look here:
http://www.tinyportal.net/index.php?topic=29849.0

It might do what you need, or you might get an idea of whats wrong with the one you want to use.

thanks for replying zetan.

i can't still get...

i put this code in my <head>

<script type="text/javascript">
  <!--
  var newwindow;
  function poptastic(url)
  {
     newwindow=window.open(\'http://test/index.html,\'Radio\',\'height=620,width=500\');
     if (window.focus) {newwindow.focus()}
  }
  // -->
  </script>


and I put this code in a portal block using a HTML & Javascript code

<a href="javascript:poptastic('http://test/index.html')">Launch Popup Window</a>

the problem is the popup window doesn't work, can you please check if there's something wrong with my code?

Zetan

I know, I read it the first time.

What theme are you adding the script to?

Popup's can be really tempermental and finiky. Without playing with the code, which I can't do right now... I have no idea what the problem might be. Try mine, it should do the same as what you need, and it works.

lyer

Quote from: Zetan on July 27, 2009, 09:57:16 AM
I know, I read it the first time.

What theme are you adding the script to?

Popup's can be really tempermental and finiky. Without playing with the code, which I can't do right now... I have no idea what the problem might be. Try mine, it should do the same as what you need, and it works.

I use Megapolis by cer. thanks for keep on replying zetan

Zetan

Well, I suggest trying my popup. It needs nothing added to any theme, you just create a file and then make a call from a block or article.. or menu button.

ZarPrime

Quote from: lyer on July 27, 2009, 06:03:43 AM
I use this code in the <head>

lyer,

Zetans popup block works fine.  I know because I've tried it before.  You'r works as well, but I don't understand what you mean by you use the code in the <head>.  Do you mean you stick it in your index.php somehow?

In any case, your code works fine as well.  You can see it on my test site in a block at the top of the left panel here (click "Brown Dwarf") ...
http://talesofthehavenexpanse.com/smf1test/index.php

Instead of putting the script in the <head> somewhere, put it right in your block.  That's what I did with your code on my test site and it works just fine.  I changed the parameters for the width and height, and of course the url of the picture, but it works fine.  Here's your code that I used, in an HTML and Javascript block ...
<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
   newwindow=window.open(url,'name','height=600,width=800');
   if (window.focus) {newwindow.focus()}
}
// -->
</script>
<a href="javascript:poptastic('http://talesofthehavenexpanse.com/rsoph_pparc.jpg');">Brown Dwarf</a>


ZarPrime

mc

Quote from: ZarPrime on July 27, 2009, 02:10:06 PM
Quote from: lyer on July 27, 2009, 06:03:43 AM
I use this code in the <head>

lyer,

Zetans popup block works fine.  I know because I've tried it before.  You'r works as well, but I don't understand what you mean by you use the code in the <head>.  Do you mean you stick it in your index.php somehow?

Could be they're using additional <head> tags in the block?
If they were, then that could cause the javascript to fail.

ZarPrime

Correct.  Using head tags and body tags in the block are a no-no, and not necessary.

ZP

lyer

#9
Quote from: ZarPrime on July 27, 2009, 05:20:58 PM
Correct.  Using head tags and body tags in the block are a no-no, and not necessary.

ZP

Thanks for replying ZP...

I use the code that you give and replacing my own url but still no luck.

please check the code I use if there's something wrong.


<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
  newwindow=window.open('http://Your_Site.net/Radio/Mp3Stream/index.html,'Radio','height=600,width=800');
  if (window.focus) {newwindow.focus()}
}
// -->
</script>
<a href="javascript:poptastic('http://Your_Site.net/Radio/Mp3Stream/index.html');">Brown Dwarf</a>


thanks...

This website is proudly hosted on Crocweb Cloud Website Hosting.