New to Java Script(Want to open a new window using Java Script)

Hi all,
I am new to using Java Script. Now I have a HTML(First.html) page with a ADD button at the end of the page. What I want to know is, if I drag and select some part of the First.html and click on the ADD button a second HTML page(Second.html) should open displaying only the selected contents....
Please help :-(

myRef = window.open(self.location,'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');

Similar Messages

  • Want to open a new browser window and display the html file in locale disk.

    Hi,
    I want to open a new browser window and display the html file in local drive. The below html applet work in local system successfully. But i deploy the same in web server (Tomcat) and try the same in client machine it does not work. Please help.
    Note:
    The class below fileopen.FileOpen.class i make it as a jar and put it in jre\ext folder at the client machine.
    ------------------------------------FileOpen.html(Tomcat)-----------------------------------------------------
    <html>
    <body >
    <applet code="OpenFile.class" archive="loadfile.jar" width="100" height="100">
    <param name="path" value="file://c:/open.html" />
    </applet>
    </body>
    </html>
    -------------OpenFile.java in server(Tomcat)--------------------------------------------
    public class OpenFile extends Applet implements ActionListener{
    String path = "";
    fileopen.FileOpen open = null;
    Button b = null;
    public void init(){
    path = getParameter("path");
    b = new Button("Open");
    b.addActionListener(this);
    add(b);
    public void actionPerformed(ActionEvent ae){
    try
    open = new fileopen.FileOpen(this,path);
    catch (Exception e){
    e.printStackTrace();
    -------------------------------------------FileOpen.java /Client JRE/ext----------------------------------------------------
    package fileopen;
    public class FileOpen
    AppletContext context = null;
    URL url = null;
    public FileOpen(Applet applet,String path)
    try
    if(null != applet){
    context = applet.getAppletContext();
    if (null != path)
    url = new URL(path);
    context.showDocument(url, "_blank");
    }catch(Exception ex)
    ex.printStackTrace();
    Please help to solve this issue very urgent.
    Thanks in advance.
    By,
    Saravanan.K.

    zzsara wrote:
    I want to open a new browser window and display the html file in local drive. ...Did you ever pause to consider how ridiculous that is?
    The best audience for applets is people off the internet. 'People off the internet' might be using a computer that has no (what was it?) 'open.html' in the root of the C: drive. In fact (shock horror) they may not even be running Windows, and would therefore probably have no 'C:' drive at all.
    If you do not intend to distribute this to people off the web, an application makes a lot more sense, but even then, you cannot rely on the document being there unless you 'put it there' (during installation, for instance).
    As the other poster intimated, applets can load documents off the local disk as long as they are trusted. Here is an example*, but note that it is not so rash as to presume any particular path or file, and instead leaves it to the user to choose the document to display.
    * The short code can be seen at SDNShare on the [Defensive Loading of Trusted Applets|http://sdnshare.sun.com/view.jsp?id=2315] post.
    On the other hand, a sandboxed applet can load any document coming from its own server via URL, or get showDocument(URL) to work. In that case, the JRE must recognize that the URL is from its own server, so the best way to form URLs for applet use is via the URL constructor
    new URL(getDocumentBase(), "path/to/open.html");That is how I form the URL in this [ sandboxed example of formatting source|http://pscode.org/fmt/sbx.html?url=/jh%2FHelpSetter.java&col=2&fnt=2&tab=2&ln=0]. Of course, in this case the applet loads the document, then parses the text to draw the formatted version, but the point is that an URL produced this way will work with showDocument(URL).
    I am pretty sure showDocument() in an applet off the internet will work with an URL pointing to a foreign (not its own) server, but it will not be able to load documents off the end user's local disks.
    I suggest a couple of things.
    - Try to express this problem in terms of what feature it is that you want to offer the end user. Your question jumps directly to a bad strategy for achieving ..who knows what? An example of a feature is "Shows the applet 'help' files on pressing F1".
    - A good way to indicate interest in a solution is to offer [Duke stars|http://wikis.sun.com/display/SunForums/Duke+Stars+Program+Overview] to match that interest.
    Edit 1:
    ..and please figure out how to use the CODE tags.
    Edited by: AndrewThompson64 on Sep 12, 2008 11:14 PM

  • HT201303 how do i associate a different apple ID with my ipad?  I need to do this bc my gmail account was hacked and a hoax email sent out from it. so i opened a new gmail account and want to associate this new email with my ipad

    how do i associate a different apple ID with my ipad?  I need to do this bc my gmail account was hacked and a hoax email sent out from it. so i opened a new gmail account and want to associate this new email with my ipad

    To check if you have a virus, you can download ClamXav
    also, go to Applications>Utilities>Activity Monitor and see if there's anything that you don't recognize, and check your sent email to see if you've been sending emails without your knowledge.

  • I am connected to the internet and I close all tabs on the screen. Now I want to open a new tab, but Firefox opens a pop-up window stating"Firefox is already running, but not responding . To open a new window, you must first close the existing Firefox pr

    I am connected to the internet, but all tabs are closed. Now I want to open a new tab, But Firefox pops-up with "Firefox is already running, but not responding. To open a new window, you must first close the existing Firefox process, or restart your system". Does anyone here know how to fix this? Thank´s, BL.
    == This happened ==
    A few times a week

    Firefox is shutting down windows I want to remain open. Example: I am done viewing one window. I click the X to shut the window and it shuts two windows. Every single time, attempt to close one windows, two windows close. Lately, I have been opening several windows with nothing but google search, just so it will shut that window and not something else I want to remain open. I could understand this if I was using tabs, but I am not. This has been going on for over two weeks. I don't like going back to history to open a window, I did not want closed in the first place. Isn't that what 'Windows' is all about? Any ideas?

  • Why my firefox stopped loading when I want to open a new tab? this will continue if I do not move the mouse. this also happen when I download.

    why my firefox stopped loading when I want to open a new tab? this will continue if I do not move the mouse. this is also happen when I download. if I does not move the mouse, the download process stops or stagnant ormanaged to download but not full

    hey, just to keep you updated - there is now a fix available for firefox 25, which should address the particular problem of pages not loading unless the mouse is moved.
    if you have downgraded to firefox 24 to work around the issue, please go to ''firefox > options > advanced > update'' and turn automatic updates back on. then go to ''firefox > help > about firefox'' which should trigger the update to firefox 25.0.1.
    <br>in case you need to download the setup file for firefox 25.0.1 separately you can do so from https://www.mozilla.org/firefox/channel/#firefox

  • Firefox does not open a new tab when you click the plus sign button which is actually a shortcut for opening a new tab. You have to open a new firefox window in order to get a new tab. Please help. Thanks.

    I didn't have this problem before with Firefox. My kids must have pressed something or clicked on something that's the open new tab button does not function anymore. No matter how you click it, it doesn't open a new tab. Even if you click on file, then go to new tab, it still doesn't open a new tab. You have to open a new firefox window in order to do multiple browsing.
    Hope you can help resolve this problem.
    Sincerely,
    Ems Guillarte

    Uninstall the Ask toolbar and it should work again. There is a compatibility issue with the Ask toolbar and Firefox that prevents new tabs from being opened. Checking your list of add-ons, the MyPlayCity toolbar is a version of the Ask toolbar.
    There are a couple of places to check for the Ask toolbar:
    * Check the Windows Control panel for the Ask Toolbar - http://about.ask.com/apn/toolbar/docs/default/faq/en/ff/index.html#na4
    * Also check your list of extensions, you may be able to uninstall it from there - https://support.mozilla.com/kb/Uninstalling+add-ons

  • HT4436 Just did a restore for a new 4S. I want to do a new iCloud account and discard the one that came with the restore. Any suggestions?

    Just did a restore for a new 4S. I want to do a new iCloud account and discard the one that came with the restore. Any suggestions?

    Welcome to the Apple community.
    Settings > iCloud, scroll down and delete the account, sign back in by choosing the option to create a new Apple ID.

  • How to run script file ( unix script file like ksh or sh file) using Java

    How to run script file ( unix script file like ksh or sh file) using Java Program?.
    I am using the following code snippet to run the simple commands like top or ls ,etc....
    Runtime runtime = Runtime.getRuntime();
    Process proc = runtime.exec("top");
    Thanks In Adavance
    -Siva

    String [] { "ksh" , "-c" , "script", "arg 1", "arg 2", "arg 3"}

  • When i open a new site on safari it always opens a new window with ads how can i stop that?

    when i open a new site on safari it always opens a new window with ads how can i stop that?

    Follow the instructions in the Apple article below.
    Remove unwanted adware that displays pop-up ads and graphics on your Mac - Apple Support

  • I have a new macbook air, and want to transfer all my data using time machine from my old macbook running leopard, is this possible and easy

    I have a new macbook air, and want to transfer all my data using time machine from my old macbook running leopard, is this possible and easy and will it transfer all my musc and photos?

    The Setup Assistant can restore your data from a Time Machine backup. You'll be asked if you want to do this the first time you turn the computer on.
    (60797)

  • Any new discoveries on Photoshop CS3 files opening slow in Windows 7?

    Any new discoveries on Photoshop CS3 files opening slow in Windows 7?

    Extend Dave's advice to also include looking for any network shares that may be mapped (e.g., to a drive letter) but not presently online.
    -Noel

  • How to access a file in Unix server from windows using java

    I want to access a file in unix server from windows using java program.
    I have the following code. I am able to open the url in a web browser.
    String urlStr="ftp:user:passwd@unix-server:ftp-port//javatest/test.csv;type=i";
    URL url = new URL(urlStr);
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream)));
    String inputLine;
    while((inputLine=in.readLine()))!=null){
    System.out.println(inputLine);
    in.close();
    I get the following error
    java.io.FileNotFoundException: /javatest/test.csv
    at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:333)
    at java.net.URL.openStream(URL.java:960)
    at com.test.samples.Test.main(Test.java:45)

    urlStr="ftp:user:passwd@unix-server:ftp-port//javatest/test.csv;type=i";
    I have given the format of the urlStr that I am using in the code. The actiual values are used in my code. I have tried pasting this url in the browser and it opens the file.

  • Diplaying non-rectangular windows using java.

    I am seeking some information regarding rendering of irregular shaped windows using java. Would like to know if its possible to achieve that using only java, if not then which tool can be used, so that my application can be used across platforms. I have gathered some information but most of the tools are not platform independent, most are useful only for windows, there is no mention of whether the tools will be helpful in UNIX etc. environment.
    Awaiting reply,
    Shweta.

    hi,
    you can create a component you like.you must override the paint method
    and paint the component itself. the Graphics Object in paint give you some methods to paint lines,areas and colors.
    the example paint a clock :
    import java.awt.Container;
    import java.util.Calendar;
    import java.awt.Graphics;
    import java.awt.Color;
    import java.awt.event.WindowListener;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionEvent;
    import javax.swing.Timer;
    import java.awt.Label;
    import java.util.TimeZone;
    import java.util.SimpleTimeZone;
    public class Uhr extends java.awt.Frame implements WindowListener,ActionListener
    //{{DECLARE_CONTROLS
    Calendar cal=null;
    int sec;
    int minute;
    int hour;
    double Rh,Rm,Rs;
    int nullx,nully,mx,my,Rk;
    Timer timer=null;
    Label lab=null;
    public Uhr()
    super();
    //{{INIT_CONTROLS
    setSize(200,200);
    setLayout(null);
    setTitle("Pit-Timer");
    cal=Calendar.getInstance();
    TimeZone tz = TimeZone.getDefault();//new SimpleTimeZone(1,"GMT");//;
    // String [] tza=new String[128];
    // tza=TimeZone.getAvailableIDs();
    // for (int i=0;i<tza.length;i++)
    // System.out.println(tza);
    cal.setTimeZone(tz);
    sec=cal.get(Calendar.SECOND);//0..59
    minute=cal.get(Calendar.MINUTE); //0..59
    hour=cal.get(Calendar.HOUR_OF_DAY);//0..23
    lab=new Label("Time");
    lab.setBounds(20,170,180,25);
    add(lab);
    addWindowListener(this);
    timer=new Timer(1000,this);
    timer.setRepeats(true);
    timer.start();
    Rk=getSize().width/2;
    Rs=Rk*0.9;
    Rm=Rk*0.8;
    Rh=Rk*0.6;
    mx=getSize().width/2;
    my=getSize().height/2;
    public static void main(String[] args)
    (new Uhr()).setVisible(true);
    public void paint(Graphics gr)
    //zeichnen Hintergrund
    gr.setColor(Color.red);
    gr.fillArc(mx-Rk/2, my-Rk/2,Rk, Rk, 0, 360);
    //zeichnen Stundenskala
    gr.setColor(Color.darkGray);
    for (double alpha=0;alpha<Math.PI*2;alpha+=Math.PI/6)
    gr.drawLine( mx+(new Double (Rk/2*Math.cos(alpha))).intValue(),
    my+(new Double (Rk/2*Math.sin(alpha))).intValue(),
    mx+(new Double (Rm/2*Math.cos(alpha))).intValue(),
    my+(new Double (Rm/2*Math.sin(alpha))).intValue());
    sekunde(gr);
    minute(gr);
    stunde(gr);
    super.paint(gr);
    public void sekunde(Graphics gr)
    double alpha;
    int x,y;
    gr.setColor(Color.blue);
    alpha=(Math.PI/30*(sec-15));
    x=(new Double (Rs/2*Math.cos(alpha))).intValue();
    y=(new Double (Rs/2*Math.sin(alpha))).intValue();
    gr.drawLine(mx,my,mx+x,my+y);
    public void minute(Graphics gr)
    double alpha;
    int x,y;
    gr.setColor(Color.green);
    alpha=(Math.PI/30*(minute-15));
    x=(new Double (Rm/2*Math.cos(alpha))).intValue();
    y=(new Double (Rm/2*Math.sin(alpha))).intValue();
    gr.drawLine(mx,my,mx+x,my+y);
    public void stunde(Graphics gr)
    double alpha;
    int x,y;
    gr.setColor(Color.yellow);
    alpha=(Math.PI/6*(hour-3));
    x=(new Double (Rh/2*Math.cos(alpha))).intValue();
    y=(new Double (Rh/2*Math.sin(alpha))).intValue();
    gr.drawLine(mx,my,mx+x,my+y);
    public void actionPerformed(ActionEvent e)
    if (e.getSource()==timer)
    sec++;
    lab.setText("Time : "+new Integer(hour).toString()+":"+new Integer(minute).toString()+":"+
    new Integer(sec).toString());
    if (sec==60)
    sec=0;
    minute++;
    if (minute==60)
    minute=0;
    hour++;
    if (hour==24)
    hour=0;
    repaint();
    public void windowActivated(WindowEvent e){}
    //Invoked when a window is activated.
    public void windowClosed(WindowEvent e)
    {//Invoked when a window has been closed.
    timer.stop();
    dispose();
    System.exit(0);
    public void windowClosing(WindowEvent e)
    timer.stop();
    dispose();
    System.exit(0);}
    //Invoked when a window is in the process of being closed.
    public void windowDeactivated(WindowEvent e){}
    //Invoked when a window is de-activated.
    public void windowDeiconified(WindowEvent e){}
    //Invoked when a window is de-iconified.
    public void windowIconified(WindowEvent e){}
    //Invoked when a window is iconified.
    public void windowOpened(WindowEvent e){}
    //Invoked when a window has been opened.
    bye

  • How to trace changes in directories and files in windows using java.

    Hi,
    Want to know how to trace changes in directories and files in windows using java.
    I need to create a java procedure that keeps track of any changes done in any directory and its files on a windows System and save this data.
    Edited by: shruti.ggn on Mar 20, 2009 1:56 AM

    chk out the bellow list,get the xml and make the procedure.....     
         Notes          
    1     Some of the similar software’s include HoneyBow, honeytrap, honeyC, captureHPC, honeymole, captureBAT, nepenthes.     
    2     Some of the other hacking software’s include keyloggers. Keyloggers are used for monitoring the keystrokes typed by the user so that we can get the info or passwords one is typing. Some of the keyloggers include remote monitoring capability, it means that we can send the remote file across the network to someone else and then we can monitor the key strokes of that remote pc. Some of the famous keyloggers include win-spy, real-spy, family keylogger and stealth spy.          
    3     Apart from theses tools mentioned above there are some more tools to include that are deepfreeze, Elcomsoft password cracking tools, Online DFS, StegAlyzer, Log analysis tools such as sawmill, etc.

  • How i can open a browser windows using a button in jsf ?

    Hi
    Thank you for reading my post
    how i can open a browser windows using a button in jsf ?
    for example if i want to open a window which will show http://www.mywebsite.com?name=TestName&family=TestFamily
    and before opening the window i need to set those two variables.
    can some one help me with a solution ?
    thank you

    Hi Legolas,
    Please refer to the answer provided by Chris in the EA forums.
    Cheers
    Giri

Maybe you are looking for