Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 2nd, 2006, 03:02 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default IE7 and JavaScript

I have an old page that displays a popup window using JavaScript within an ASP page, like this:
Response.Write("<a href='" + strCurrentQSURL + "&print=true' onclick=""NewWindow(this.href,'name','800','600',' yes');return false;"" target='_blank'>Printer-friendly Version</a>")

...but when I tested this link in IE7, it crashed the app all together. When I removed the reference to onclick=""NewWindow(this.href,'name','800','600',' yes');return false;"", it worked fine. I want to keep the window-resize feature, so is there a way to make this javascript open window code work in IE7? Thanks for any help.

KWilliams
Reply With Quote
  #2 (permalink)  
Old November 2nd, 2006, 03:16 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...by the way, here's the function that goes with it:

Code:
<!-- Begin
    if (window != top) top.location.href = location.href;

    function NewWindow(mypage, myname, w, h, scroll)
    {
     var winl = (screen.width - w) / 1.5;
     var wint = (screen.height - h) / 1.65;
     winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
     win = window.open(mypage, myname, winprops)
     if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }
 
    var isNN = (navigator.appName.indexOf("Netscape")!=-1);
    function autoTab(input,len, e) {
    var keyCode = (isNN) ? e.which : e.keyCode; 
    var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
    if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
    }
    function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
    }
    function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
    }
    return true;
    }
   //  End -->


KWilliams
Reply With Quote
  #3 (permalink)  
Old November 6th, 2006, 02:33 AM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you have to escape double-quotes by using the backslash instead of double-double-quotes. I thought that was true for all versions of javascript but I could be mistaken.

IE6 doesn't appear to give you an error but I don't think it works correctly either. IE7 actually gives an error.

David

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript works in IE7 not in FF 2 swifty_programmer Javascript 2 August 31st, 2007 02:07 AM
transparentcy and on anything less then IE7 mark jonas PHP How-To 0 March 9th, 2007 09:03 AM
Hack for IE7 Adam H-W CSS Cascading Style Sheets 4 January 23rd, 2007 10:02 AM
JSB2 and IE7 Appleby JSP Basics 0 January 12th, 2007 08:56 PM
IE7 0.7 Snib HTML Code Clinic 2 July 29th, 2004 09:52 AM



All times are GMT -4. The time now is 12:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.