SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Location
    Miami FL
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript within a javascript

    I want to know how I can call another javascript using javascript...

    I've got a poll which uses javascript for displaying the results, and I want the results in its own pop-up... so how is it done?

    is it like this ?

    PHP Code:
      <a href="javascript:demo('javascript:ppoll1_submit();')"
    Last edited by Fredo; May 9, 2002 at 02:09.

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <script type="javascript">

    var 
    '';

    '<script type=\"javascript\">';
    x+= 'document.write("your")     ;';
    x+= 'document.write(" content") ;';
    x+= 'document.write(" here")    ;';
    x+= '</s'+'cript>                ';
    </script> 
    this will now work and doesn't make sense, however this does

    PHP Code:
    <script type="javascript">
    function 
    a()
    {
     
    a='Fredo';
     return 
    a;
    }
    </script>

    <a href="javascript:document.write(demo(a))"> 
    you might want to explain a bit more?

    But i'm guessing you want to pass a script to a a popup window

    PHP Code:
    <script type="javascript">

      
    win window.open('','','');
      
      
    '<script type=\"javascript\">';
      
    x+= 'document.write("your")     ;';
      
    x+= 'document.write(" content") ;';
      
    x+= 'document.write(" here")    ;';
      
    x+= '</s'+'cript>                ';

      
    win.document.write(x);

    </script> 

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Location
    Miami FL
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey....

    thanks for your reply... but considering I dont know ANYTHING when it comes to javascript, it didnt really help me much...

    yes you are right I am trying to pass a script to open in a pop-up, the pop-up script I am using is the following

    PHP Code:
    <script language="JavaScript">
    <!-- 
    Begin
    function demo(page) {
    OpenWin this.open(page"CtrlWindow""toolbar=no,menubar=no,location=no,resize=no,scrollbars=no,width=300,height=300");
    }
    // End -->
    </script> 
    and this is called like this

    PHP Code:
     <a href="javascript:demo('whatever.html')"
    now I have to call another javascript instead of whatever.html

    so how do I do it?

    the poll programs script is

    PHP Code:
      <Script Language="JavaScript"><!------------
            function 
    ppoll1_submit() {
                
    document.forms["ppoll_form1"].action.value="VOTE";
                
    document.forms["ppoll_form1"].submit();
            }
            function 
    ppoll1_results() {
                
    document.forms["ppoll_form1"].action.value="RESULTS";
                
    document.forms["ppoll_form1"].submit();
            }
            function 
    ppoll1_about() {
                
    window.alert("Prowler Poll is a Perl CGI script written by Mike Snyder, Copyright (C) 1999 by Prowler Productions. Prowler Poll is distributed FREE of charge. Download a copy for YOUR web site from [url]www.prowler-pro.com/prowlerpoll[/url] today!");
            }
        
    //----></SCRIPT> 
    and it gets called using the below line

    PHP Code:
    javascript:ppoll1_submit(); 
    well thats ALL I know.... hope you can help... thanks again....

    later


Bookmarks

Posting Permissions

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