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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2 java scripts not working together- not an onload prob

    I have done my homework, and I really appreciate you all helping me, because I am really stuck! I am using 2 dynamic drive DHTMLs, one for a "Print this page" button and one so that all links to outside sources open in a new window.

    When I put just one of the two scripts on a page, it works- so the problem is definitely the two of them together. The tutorials I read keep mentioning conflicting commands within the scripts, specifically, onload problems. However, the print this page script has no onload!

    What am I missing here? Thanks for helping out.


    CODE FOR NEW WINDOW- I FOUND THE ONLOAD COMMAND HERE (AT THE VERY END)

    <SCRIPT language=JavaScript1.2><!--//Open offsite links in new window option- By Jessica Hammer//Heavily modified by Dynamic Drive//Visit http://www.dynamicdrive.com for this script//1)Enter domains to be EXCLUDED from opening in new window:var excludedomains=["dynamicdrive.com", "javascriptkit.com"]//2)Automatically open offsite links in new window? (1=yes, 0 will render a checkbox for manual selection)var auto=1var excludedomains=excludedomains.join("|")rexcludedomains=new RegExp(excludedomains, "i")if (!auto)document.write('<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="dynamiclink()">Open off-site links in new window</form>')function dynamiclink(){if (auto||(!auto&&document.targetmain.targetnew.checked)){for (i=0; i<=(document.links.length-1); i++) {if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)document.links[i].target="_blank"}}elsefor (i=0; i<=(document.links.length-1); i++) {if (document.links[i].hostname.indexOf(mydomain)==-1)document.links[i].target=""}}if (auto)window.onload=dynamiclink// --></SCRIPT>



    CODE FOR PRINT BUTTON (NO ONLOAD??? AM I BLIND??)

    <SCRIPT language=Javascript>/*This script is written by Eric (Webcrawl@usa.net)For full source code, installation instructions,100's more DHTML scripts, and Terms OfUse, visit dynamicdrive.com*/function printit(){ if (window.print) { window.print() ; } else { var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = ""; }}</SCRIPT>

    <SCRIPT language=Javascript> var NS = (navigator.appName == "Netscape");var VERSION = parseInt(navigator.appVersion);if (VERSION > 3) { document.write('<form><align=center><input type=button value="Print this Page" name="Print" onClick="printit()"></form>'); }</SCRIPT>

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be going blind, I'd go blind trying to read a jumble like that. Try posting the code in a formatted fashion instead of run-on.

    Of course you should have posted this in the Dynamic Drive forum instead of this one but you can ask a moderator to fix that.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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