If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2008
    Member #
    Hi, I am just learning javaScript, and I need to do a Webpage urgently, a new window will open up when we click on them. I wrote a code acording to my best knowledge, been trying to correct it for days and it juxt does not work. Can anyone help? I have kitchen0.html that I would like to open, I put idó"img0" to the image link in the html file. The browser said there is an error on the page.The code I wrote:
    window.onload = initAll;
    function initAll(){
    document.getElementById("img0").onclick = newWindow;
    function newWindow(){
    var imgWindow =,"imgWin", "width=400, height=300, scrollbars=0");
    Please can anyone help!!!!


  3. #2
    Senior Member
    Join Date
    May 2003
    Member #
    The error you are probably having is that img0 is not defined yet. What browser did you test this page with? I suggest using a browser named Firefox, it's error console is very good.

    Try the below code.

    HTML Code:
    	<title>JS test</title>
    	<script type="text/javascript">
    	function newWindow()
    		var imgWindow ='kitchen.html',"imgWin", "width=400, height=300, scrollbars=0");
    	<div id="img0" onclick="javascript: newWindow();">Click me</div>

  4. #3
    Senior Member
    Join Date
    Jun 2005
    Atlanta, GA
    Member #
    1 times
    What error does the browser say there is? If you're in IE, double-click on the little warning symbol in the bottom right. If you're in Firefox, click Tools->Error Console. You should be able to get some info about the error that happened. Not a particularly useful one in IE, in general, but at least some pointer as to where it is.

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 09:01 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: