Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript Ie Pop Up Blocking Problem

Options
  • 29-01-2006 12:29am
    #1
    Closed Accounts Posts: 1,541 ✭✭✭


    Hello

    I have put some Javascript code embedded in some html. It just makes some text flashing. Some of the Javascript code was copied into the head section while the body tag and body contents also contains Javascript code.

    It workd fine but when I open the page in IE I get that POP Up WARNING AND A BAR AT THE TOP HAS TO BE CLICKED TO UNBLOCK IT - BUT THERE IS NO POP UP. aLL IT IS IS jAVASCRIPT CODE TO MAKE SOME TEXT FLASH.

    aNY IDEAS ON HOW TO GET ROUND THIS. I also have some Jvascript buttons which also may cause the problem.

    Here is the Java script code:

    In Head Section after title and META tags:
    <script type="text/javascript"> 
    <!-- 
    var b_timer = null; // blink timer 
    var b_on = true; // blink state 
    var blnkrs = null; // array of spans 
    
    function blink() { 
    var tmp = document.getElementsByTagName("span"); 
    if (tmp) { 
    blnkrs = new Array(); 
    var b_count = 0; 
    for (var i = 0; i < tmp.length; ++i) { 
    if (tmp[i].className == "blink") { 
    blnkrs[b_count] = tmp[i]; 
    ++b_count; 
    } 
    } 
    // time in m.secs between blinks 
    // 500 = 1/2 second 
    blinkTimer(500); 
    } 
    } 
    
    function blinkTimer(ival) { 
    if (b_timer) { 
    window.clearTimeout(b_timer); 
    b_timer = null; 
    } 
    blinkIt(); 
    b_timer = window.setTimeout('blinkTimer(' + ival + ')', ival); 
    } 
    
    function blinkIt() { 
    for (var i = 0; i < blnkrs.length; ++i) { 
    if (b_on == true) { 
    blnkrs[i].style.visibility = "hidden"; 
    } 
    else { 
    blnkrs[i].style.visibility = "visible"; 
    } 
    } 
    b_on =!b_on; 
    } 
    //--> 
    </script>
    <style type="text/css"> 
    .blink { 
    font-size: 15px; 
    color: red; 
    display: inline; 
    } 
    </style>
    
    
    
    
    
    
    
    
    
    
    		
    		<script language="JavaScript">
    <!--
    function FP_swapImg() {//v1.0
     var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
     n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
     elm.$src=elm.src; elm.src=args[n+1]; } }
    }
    
    function FP_preloadImgs() {//v1.0
     var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
     for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
    }
    
    function FP_getObjectByID(id,o) {//v1.0
     var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
     else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
     if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
     for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
     f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
     for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
     return null;
    }
    // -->
    </script>
    


    Body Tag:
    <body onload="FP_preloadImgs(/*url*/'button6D.jpg', /*url*/'button6E.jpg'); blink()" onload="FP_preloadImgs(/*url*/'button10.jpg', /*url*/'button11.jpg', /*url*/'button1D.jpg', /*url*/'button1E.jpg', /*url*/'button20.jpg', /*url*/'button21.jpg', /*url*/'button23.jpg', /*url*/'button24.jpg', /*url*/'button26.jpg', /*url*/'button27.jpg', /*url*/'button29.jpg', /*url*/'button2A.jpg', /*url*/'button2C.jpg', /*url*/'button2D.jpg', /*url*/'button2F.jpg', /*url*/'button30.jpg', /*url*/'button32.jpg', /*url*/'button33.jpg', /*url*/'button38.jpg', /*url*/'button39.jpg', /*url*/'button49.jpg', /*url*/'button4A.jpg', /*url*/'button58.jpg', /*url*/'button59.jpg', /*url*/'button64.jpg', /*url*/'button65.jpg', /*url*/'button6D.jpg', /*url*/'button6E.jpg')" background=back.jpg>
    

    Body Code:
    <span class="blink"><font size="7">
    <a href="http://www.somepage.com/hh..html">Some Flashing Text</a> </font> </span>
    <p align="center"><span class="blink"><font size="5">
    </font></span>
    


Comments

  • Registered Users Posts: 5,618 ✭✭✭Civilian_Target


    You're making something blink, right?

    Why not use the HTML <BLINK> </BLINK> tags?


  • Moderators, Education Moderators Posts: 2,432 Mod ✭✭✭✭Peteee


    You're making something blink, right?

    Why not use the HTML <BLINK> </BLINK> tags?

    AFAIK the <blink> tags arn't supported anymore, due to the feature being far too annoying!

    EDIT: Whoops, just tested it there, and they do indeed still work!


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    Peteee wrote:
    AFAIK the <blink> tags arn't supported anymore, due to the feature being far too annoying!

    EDIT: Whoops, just tested it there, and they do indeed still work!

    They don't work with my version of IE anyway.

    Also, I would like to get rid of this pop up warning whenever I use Javascript - anyideas?

    Thanks.


  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    finnpark wrote:
    They don't work with my version of IE anyway.

    Also, I would like to get rid of this pop up warning whenever I use Javascript - anyideas?

    Thanks.

    Forget the popup. Open a new window instead, sized as a popup.
    Much easier and it will not be blocked.


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    is_that_so wrote:
    Forget the popup. Open a new window instead, sized as a popup.
    Much easier and it will not be blocked.

    I don't actually have a pop up - thats the problem. Windows IE is telling me that its blocking a pop up but there is no pop up. Its just Javascript making the text blink. Not sure why ie is doing this:mad:


  • Advertisement
  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    Based on this link it appears that blink doesn't work in IE. You may want to look at another option.

    http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.languages.vb/2005-11/msg00139.html
    I would make a comment on it. I am not sure why you need to have blinking text. It is distracting. An animated gif or an applet may offer the same effect.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Blink only works in Netscape based browsers AFAIR. BLINK and MARQUEE are two tags you should stay the heck away from.

    Heres a good info on it.
    http://www.mcli.dist.maricopa.edu/tut/tut17.html


  • Registered Users Posts: 5,335 ✭✭✭Cake Fiend


    Presumably you mean a security warning bar rather than a popup warning bar
    ("To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer. Click here for options...")

    This shows when you try to run a script in a page. Not sure if there's a way to stop that showing through code - more than likely it has to be turned off in the client browser.
    Hobbes wrote:
    BLINK and MARQUEE are two tags you should stay the heck away from.

    More for people's sanity than for browser incompatibility IMO ;)


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    This problem had me tearing my hair out when I was redoing the intranet pages at work over the summer. The problem is that XPSP2 is blocking Javascripts running on a local machine, presumably because it thinks its out to kill your computer. Its pretty simple to fix this, all you have to do is add a single line to the top of your page called the Mark of the Web. Talk about your B-Movie title...
    To give a web page a "Mark of the Web" add in "saved from url" comment text at the start of the file. There are two possible incantations:

    1. <!-- saved from url=(0014)about:internet -->
    2. <!-- saved from url=(0020)http://www.phdcc.com -->

    The number in brackets is the length of the string that follows it.

    This tells IE to parse the page ignoring the local security settings, running it as if it were an internet page.


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    This problem had me tearing my hair out when I was redoing the intranet pages at work over the summer. The problem is that XPSP2 is blocking Javascripts running on a local machine, presumably because it thinks its out to kill your computer. Its pretty simple to fix this, all you have to do is add a single line to the top of your page called the Mark of the Web. Talk about your B-Movie title...



    This tells IE to parse the page ignoring the local security settings, running it as if it were an internet page.

    Brilliant Thanks.

    Works a treat.;)


  • Advertisement
Advertisement