Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-23-2004, 04:21 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default I'm having difficulty getting a Pop Up Window to work

Hi!

I'm having some difficulty getting a link to open a Pop Up Window.

Here's what I'm using:


HTML Code:
 
This is the Regular Link:
 
(<a href="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadid">Execute Test Action</a>)
 
 
This is what I'm trying to modify it to, in order to get it to open in a Pop Up Window:
 
(<a href="#" onclick="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadid; return false;">Execute Test Action</a>)
 
 

Obviously, I'm making a mistake. Can someone help me figure out what I'm doing wrong?


Thanks!
Reply With Quote
  #2  
Old 10-23-2004, 04:27 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ocean
Hi!

I'm having some difficulty getting a link to open a Pop Up Window.

Here's what I'm using:


HTML Code:
 
This is the Regular Link:
 
(<a href="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadid">Execute Test Action</a>)
 
 
This is what I'm trying to modify it to, in order to get it to open in a Pop Up Window:
 
(<a href="#" onclick="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadid; return false;">Execute Test Action</a>)
 
 

Obviously, I'm making a mistake. Can someone help me figure out what I'm doing wrong?


Thanks!
Like a vB Menu popup, or a new window popup, do you need to control any aspects of the browser window, like heigh / size resiablity, disalbing anything else?
Reply With Quote
  #3  
Old 10-23-2004, 04:33 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery

Like a vB Menu popup, or a new window popup, do you need to control any aspects of the browser window, like heigh / size resiablity, disalbing anything else?
I'd like this to function similarly to the vBCode Pop Up, or the Who Posted Pop Up.

I don't really need to disable anything (except maybe the Status Bar - similar to how the Who Posted pop up does it), and I would like it to remain resizeable (if the user should drag out the lower right corner of the window).
Reply With Quote
  #4  
Old 10-23-2004, 11:08 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Zachery, does this mean that you know where I went wrong?
Reply With Quote
  #5  
Old 10-24-2004, 10:23 PM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
<a href="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadidtarget="threadpop" onclick="window.open(this.href,this.target,width=400,height=400); return false;">Execute Test Action</a
Then you just adjust your width and height statement to match the contents of the popup, and it will degrade nicely if your users have javascript turned off...

You can also add other options after the width, height statements but still in the parenthesis to specifry which options you wanna turn on (status, resize, etc) - thje exact wording for these you can find on w3schools.com (I always rtfm, rather than using up precious memory space in my head with the exact wordings...)
Reply With Quote
  #6  
Old 10-25-2004, 03:48 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Natch

PHP Code:
 
<a href="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadidtarget="threadpop" onclick="window.open(this.href,this.target,width=400,height=400); return false;">Execute Test Action</a
Then you just adjust your width and height statement to match the contents of the popup, and it will degrade nicely if your users have javascript turned off...
Natch, thank you for helping!

I have a few questions, though...


1. The syntax I originally tried, I have seen used before successfully. I recall its being recommended as it bypassed Javascript - and thus, wouldn't cause problems for people who had it turned off. If that's true, why didn't it work for me?

2. I tried your suggested syntax, and I have mixed results. The good news is that it does indeed open a Pop Up. The bad news is that the width and height settings seem to be ignored. Do they need to be specified differently?


Thanks again!
Reply With Quote
  #7  
Old 10-25-2004, 04:32 PM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1] Your original code is
PHP Code:
<a href="#" onclick="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadid; return false;">Execute Test Action</a
Should be
PHP Code:
<a href="#" target="windowname" onclick="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadid; return false;">Execute Test Action</a
^^ That would work, but it's not really ideal as you have no control over the structure or "features" of the window...

2] OK: the structure of the window.open() function is as follows...
Code:
window.open(this.href,this.target,"toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400")
There was an omitted set of Quotes in my code above around the final argument of the function...

The structure can be broken down into three arguments: link URI, window name (same as target), and features.

Link can be either a quoted URI (eg "forumdisplay.php?f=1342") or a legal DOM reference (aka this.href refers to the contents of the href statement in this a tag... ).

Window Name similarly can be either a quoted value for the window name (eg "_blank", "mypopup") or a legal DOM reference (aka this.target refers to the target field in this a tag... ).

This example above uses the extended version of the code for features, the only features that require a name=value structure are width and height, the others you only need to include a feature name if you wish it to be active.

So: your code should be
PHP Code:
<a href="showthread.php?$session[sessionurl]do=testaction&amp;t=$threadidtarget="threadpop" onclick="window.open(this.href,this.target,'width=400,height=400,resize'); return false;">Execute Test Action</a
The reason this is a really ideal way of creating your popup links is that it will degrade well if users have JS turned off, in that a new window will still open, due to the target value being a real name, if it's blank, then it opens in this window...

Final Note:

A funky implementation or this is in the following example...
PHP Code:
<tr><td id="approach" class="row1" onmouseover="changeSty('row1hi',this.id)" onmouseout="changeSty('row1',this.id)" onclick="navCMPS(this.firstChild.href)"><a href="/somelink.php">a Linkage</a></td></tr
This is a part of a Navigation menu, and the two JS functions called are either changing the style onmouseover the Table Cell, or causing a link/popup to be called onclick of the Table Cell, without requiring much alteration for each new line... the opnly two changes reuquired are the link and name, and the link ID should be unique for each link...

HTH
Reply With Quote
  #8  
Old 10-25-2004, 05:02 PM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Natch

The reason this is a really ideal way of creating your popup links is that it will degrade well if users have JS turned off, in that a new window will still open, due to the target value being a real name, if it's blank, then it opens in this window...
Your corrected code works perfectly. And I have taken your reasons for using this method to heart.

Thank you for your excellent help!
Reply With Quote
  #9  
Old 10-26-2004, 07:57 AM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My pleasure: javascript is really your friend these days: so powerful in combination with PHP and a database...
Reply With Quote
  #10  
Old 10-26-2004, 11:09 AM
Ocean's Avatar
Ocean Ocean is offline
 
Join Date: Mar 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Natch

My pleasure: javascript is really your friend these days: so powerful in combination with PHP and a database...
I guess I need to spend more time with this friend... <grin>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:42 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04851 seconds
  • Memory Usage 2,286KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_html
  • (6)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete