Voting javascript popup for website JavaScript 

Newbie Spellweaver
Joined
Nov 21, 2006
Messages
5
Reaction score
0
Well,I had done that work for a mu server but I did it for free. The code is not mine but the graphics are ;) So I guess I have all the rights to make a guide about that since the code is free! :P

step 1.
You must add the following line in the HEAD tag of your mainpage:

Code:
<head> 
....blah blah blah...
<script type="text/javascript" src="YOUR_PATH_HERE/votebox.js"></script>

</head>


step 2.
save the following code as a file with name "votebox.js" and put it in the folder you named as YOUR_PATH_HERE ( you get what i mean. I hope.. :p )

Code:
/******************************************
* Popup Box- By Jim Silver @ [email protected]
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
******************************************/

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////

function hidebox(){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}



Now the system knows WHERE the file is and knows WHAT to do. But it does not know HOW and WHEN to do it. so we go to step 3.

Step 3.
Add right after the BODY tag of your html page (or the index.php page you have) the following code:

Code:
<div id="showimage" style="position:absolute;width:300px;left:90px;top:370px">

<table border="0" width="1000px" height="300px"  bgcolor="#453734" cellspacing="0" cellpadding="2">
  <tr>
    <td width="100%">
    	
    	<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0"
    height="25px">
      <tr>
        <td id="dragbar" style="cursor:hand; cursor:pointer" width="100%" height ="22px" onMousedown="initializedrag(event)"><ilayer width="100%" onSelectStart="return false"><layer width="100%" onMouseover="dragswitch=1;if (ns4) drag_dropns(showimage)" onMouseout="dragswitch=0"><font face="Verdana" size="4" 
        color="#d9952b"><strong><small>Vote for us - If you experience problem of black page, download and run Firefox Browser</small></strong></font></layer></ilayer></td>
        <td style="cursor:hand" height ="25px" ><a href="#" onClick="hidebox();return false"><img src="http://img214.imageshack.us/img214/2522/closeox4.gif" width="21px"
        height="21px" border="0px"></a></td>
      </tr>
      <tr>
        <td width="100%" align="center" valign="middle" bgcolor="#eeeedd" style="padding:4px" colspan="2">

<!-- PUT YOUR CONTENT BETWEEN HERE -->
<center>
<IFRAME SRC="http://digg.com" WIDTH="1000" HEIGHT="300"></IFRAME>
<!-- END YOUR CONTENT HERE -->
<!-- Credits for the layout and graphics: Laseen @ ragezone, 
mail: Caveman_gr@yahoo_REMOVETHIS.com -->
</td>
      </tr>
    </table>
    
    </td>
  </tr>
</table>
</div>


Tadaaa! You are done! Instead of IFRAME you may add anything you want. Internet explorer freaks out with the IFRAME so you'd better use firerox of opera if you use that tag.

Now there is another tweak you must do if you have flash in your page. If there is flash loaded with the EMBED tag your votebox will not be drag-able. That happens because EMBED is not standard HTML. You have 2 choises:

1)either use standard XHTML for loading the flash objects you have
OR
2)make a quick&addition to the embed tag like that:

Code:
<embed name="movie" wmode="transparent" swliveconnect="true" src="YOUR_SWF_SOURCE" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="YOUR_HEIGHT" width="YOUR_WIDTH"></embed>

the extra addition is the wmode="transparent" part that makes your flash object go to the bottom layer of the browser's render ;)

If you dont use flash then obviously you dont have to make any flash-tweaking :P



Credits for the layout and graphics:
Laseen @ ragezone,
mail: Caveman_gr@yahoo_REMOVETHIS.com

Credits for code as referred in the votebox.js:
* Popup Box- By Jim Silver @ [email protected]
* Visit for full source code
* This notice must stay intact for use
 
Last edited:
Re: [Guide] Voting javascript popup for website

pffff.....:bomb:

I attach a sample file with all necessary code.... use that!
 

Attachments

Last edited:
Re: [Guide] Voting javascript popup for website

What comes for blablabla... ?
 
Re: [Guide] Voting javascript popup for website

Try not being such an asshole next time...


It works, although PHP is still a better way to go. (and considering you didn't write the code you shouldn't be such an asshole about it)
Can easily disallow js and this won't work.
 
Re: [Guide] Voting javascript popup for website

well, for me didnt worked :S
 
Re: [Guide] Voting javascript popup for website

blah blah blah= TITLE, meta,other scripts .... ;)

smartass Lithic with PHP its *impossible* to do a floating iframe.

Yes its javascript, but if you disable the javascript you will not be able to do other javascript tasks e.g. reseting your character using mutoolz. So, think twice before speaking.

A way of blocking it, is adding the votebox.js to the blocked content of your browser. But its really so much easier to click the "X" button....

hermes the .zip works fine. Unzip it in a folder and open the .html file! You should get a floating frame of digg.com :)
 
Re: [Guide] Voting javascript popup for website

for me works :rofl:

/edit : i fixed it a little xD
 

Attachments

  • works - Voting javascript popup for website - RaGEZONE Forums
    works.webp
    25.8 KB · Views: 436
Re: [Guide] Voting javascript popup for website

pffff.....:bomb:

I attach a sample file with all necessary code.... use that!

ok thx worked now-_- but u know what, you shouldnt start insulting ppl here because we're not all php coders, and you better go to physiatrist not me.
 
Re: [Guide] Voting javascript popup for website

ok thx worked now-_- but u know what, you shouldnt start insulting ppl here because we're not all php coders, and you better go to physiatrist not me.

I visit one every Sunday. Do you need his address? ^_^
And btw, I dont believe i insulted you.

If someone should feel insulted is Lithic. :P


@silvers: nice dude!! :thumbup:
 
Re: [Guide] Voting javascript popup for website

blah blah blah= TITLE, meta,other scripts .... ;)

smartass Lithic with PHP its *impossible* to do a floating iframe.

Yes its javascript, but if you disable the javascript you will not be able to do other javascript tasks e.g. reseting your character using mutoolz. So, think twice before speaking.

A way of blocking it, is adding the votebox.js to the blocked content of your browser. But its really so much easier to click the "X" button....

hermes the .zip works fine. Unzip it in a folder and open the .html file! You should get a floating frame of digg.com :)


Mmhm...
Look around at other posts buddy, theres all kinds of PHP **** around here.
If anyone actually uses this then they are going to be disappointed because a lot of people in foreign countries use programs like Peer Guardian or they have cookies and JS blocked.
Not even worth the time to add it in if no one ever sees it now is it?
And most servers are using SQL and PHP, not javascript. So maybe you should think twice before posting.

Read the rules, no spamming other sites. Next time just show a blank box and not some gay ass site.


I visit one every Sunday. Do you need his address? ^_^
And btw, I dont believe i insulted you.

If someone should feel insulted is Lithic. :P


@silvers: nice dude!! :thumbup:


Why would I be insulted by a dumbass n00b?
Hmm....
Yea I'm not.
 
Re: [Guide] Voting javascript popup for website

You are retarted. And lack programming knowledge. Actually i believe you know a **** about programming. Its pointless to keep talking.
 
Re: [Guide] Voting javascript popup for website

gezz, can you guys stop?

anyway, thanks.

to those ppl who paid for this kind of ****, YOU JUST WASTING YOUR MONEY.
 
Re: [Guide] Voting javascript popup for website

yep works perfect :P :D

but i hate tittle "use fire fox" :D

fire fox :'(

Opera :)

Laseen - Voting javascript popup for website - RaGEZONE Forums
 
Re: [Guide] Voting javascript popup for website

ppl dont vote if u force em... unless they are idiots lol XD
these scripts generally decrease server popularity...
 
Re: [Guide] Voting javascript popup for website

yeh RK thats right but some times people don't vote for u at all witch sux xD anyway good job
 
Re: [Guide] Voting javascript popup for website

Not bad but i daresay its bater :)
<SCRIPT language=JavaScript type=text/javascript>
<!--
var detStatus=confirm("Plz Vote !");
if (detStatus)
window.location = "http://mu.hopzone.net/vote.php?site=6161";
else
document.write("");

//-->
</SCRIPT>
 
Re: [Guide] Voting javascript popup for website

How do i make it so the links that you click on in the java window open in a new tab or window.
 
Back