Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Help requested

  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening a new page and the js window on that page

    Hello js pros of all ages and sizes!
    I have a question for you and any help would be appreciated.

    I have a webpage (these are examples only):
    http://www.widgetname.com/widget.php
    and on that page are several clickable links that open js windows with content.
    eg:
    javascript:jsOpenWnd (372,'widgetname','widgetname2')

    Is there a way I can make a link from another page, eg:
    http://www.widgetname2.com/widget.php that will go to the javascript window content from the first page?

    PS: The page I want to link from is a different website. So I want to link from www.whackywidgetsite.com/page1.html to the other site's webpage and have the javascript window on the other website open automatically without having to re-direct the user to the page first and then make them look for the appropriate js link.

    I don't want the link to have to go back to the first page and then have the user click on a link just to open the js window, can I combine the two into one link?

    Any help would be appreciated and if this request isn't too clear then, well...you should see my desk!

    Thanks
    BaseVinyl
    Last edited by BaseVinyl; 06-02-2004 at 06:09 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts
    make the javascript part a js file and then pass it as
    *script language="Javascript" src="whatever.js"*

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks FJ!

    I'm not sure exactly what you mean though could you maybe elaborate a bit?

    If I'm on Page1 of Site1 and I want a link on that page to open a window that is a js window on Page2 of Site2 how would I work the code you suggested?

    Thanks for the help!

    BV

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts
    a js file is just a javascript file or simply put the javascript itself above your "head" statement in your html page.
    Definitely look for a quick tutorial on it, it WILL be quick, don't sweat it.

    It's pretty much just
    document.write{ pasted script with all quotes changed to apostrophes}
    so you'd just copy and paste the script in, change the " to ' and then snip it from the original page. Save that file as whatever.js then upload whatever.js to your server.
    On any page from then on, if you want to use that script you just type in that *script language="Javascript" src="whatever.js"* line I mentioned.
    Now this is gonna be a tiny file.
    If you're doing it on site 2, due to site permissions, you might not be able to change the above src=http://www.siteone.com/whatever.js" and "call it" from the first site. If not, no worries, just upload this small file to the site 2 server.
    One tip, if you plan to do this alot. Create a directory named "Scripts" or "JavaClass" or "Java" or somesuch. Then when you're filling out that src=whatever.js you know exactly where they are. Like how folks do with image tags(img src) and directories(Pics, Images, Pictures directory names).

    Again, very easy. Do NOT sweat a quick tutorial on js files. Hit google or webmonkey or dynamicdrive or whatever and search for "js file". Maybe post the link here so others can use it. Lemme know how you make out.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •