PDA

View Full Version : will not open new window in ie



t0li3t
Aug 5th, 2012, 10:49 PM
I am trying to make a popup for a gaming site. This code works perfect in firefox but when used in internet explorer it will not open a new window. any help on this code would be appreciated.


<div class="moduletable">
<div id="bgbtm">
<script type="text/javascript">// <![CDATA[
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating te use of another browser).
{
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function createCookie(name,value,min) {
if (min) {
var date = new Date();
date.setTime(date.getTime()+(min*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}


window.onload = function vote_popup() {

var ver = getInternetExplorerVersion();
if(navigator.appName == 'Microsoft Internet Explorer' && ver < 7.0)
{
return;
}

sgvote6 = readCookie('sgvote6');

if (sgvote6 == null) {
document.getElementById('vote_popup').style.display = "block";
}

}

function hide_vote_popup() {
createCookie('sgvote6','yes','1440');
document.getElementById('vote_popup').style.display = "none";
document.getElementById('vote_popup').innerHTML = "";
alert("We will remind you again!");
};
function hide_voted_popup() {
createCookie('sgvote6','yes','1440');
document.getElementById('vote_popup').style.display = "none";
document.getElementById('vote_popup').innerHTML = "";
alert("Please Click The Green Button..Thank you for Voting!");
};
// ]]></script>
<div id="vote_popup" style="background: transparent url(http://img197.imageshack.us/img197/4172/transa.png) repeat scroll 0% 0%; width: 100%; height: 100%; position: fixed; left: 0px; right: 0px; top: 0px; bottom: 0px; color: #f0f0f0; font-size: 9px; text-align: center; z-index: 99999; display: none;">
<div style="margin-top: 300px; width: 798px; margin-left: auto; margin-right: auto; display: block;"><span style="color: white; font-size: medium;"> </span> <span style="color: white; font-size: large;"><strong>Click here to vote for DTA on top100clans!</strong> </span> <br /> <br />
<p><a href="http://www.top100clans.com/index.php?a=in&amp;u=t0li3t" target="_blank" <span onclick="hide_voted_popup();"> <img src="http://i1191.photobucket.com/albums/z475/Dean_Parks/dta_top_100_clans.jpg" border="0" title="Click to vote for your w/e u want voted for!" style="border-color:" /> </a><br /> <br /><span onclick="hide_vote_popup();"> <span style="cursor: pointer; font-family: Tahoma; font-size: x-small;"> <span style="font-size: xsmall;">Remind me to vote tomorrow</span> </span> </span></p>
</div>
</div>
</div> </div>
</div>

Logic Ali
Aug 5th, 2012, 11:45 PM
<a href="http://www.top100clans.com/index.php?a=in&amp;u=t0li3t" target="_blank" <span onclick="hide_v

See if fixing the broken markup does anything.

t0li3t
Aug 6th, 2012, 07:26 AM
Nope still not working

Lerura
Aug 6th, 2012, 08:55 AM
remove the highlighted line:
function hide_voted_popup() {
createCookie('sgvote6','yes','1440');
document.getElementById('vote_popup').style.display = "none";
document.getElementById('vote_popup').innerHTML = "";
alert("Please Click The Green Button..Thank you for Voting!");
};

IE completes the onclick before it focuses on the href, thus the link is removed at the time it is ready to focus on the link.

t0li3t
Aug 6th, 2012, 09:05 PM
Thanks that fixed it