...

View Full Version : custom alert box



ycpc55
01-07-2007, 12:41 AM
hi
is there anyway to make a custom alert box? or anyway to have a click able link on a normal alert box like this click here without a button?thanks...

whizard
01-07-2007, 04:12 AM
That's not possible with javascript, alternatively, you could do something like this: http://www.javascriptkit.com/script/script2/customerror.shtml..

Keep in mind that popup blockers could block that.. (mine did)

Dan

Arbitrator
01-07-2007, 04:12 AM
You can make your own alert box using HTML, CSS, and JavaScript, but you canít customize the alert box invoked by alert().

Gah. whizard beat me. :p

whizard
01-07-2007, 04:19 AM
Edit: Gah. whizard beat me.

:D

Just a question since I've been wondering this forever...

How exactly do you get the little box around your edit text?

Dan

Arbitrator
01-07-2007, 04:22 AM
Easy enough: [edit][\/edit]. Youíd remove the red character, of course. See the vB code page (http://www.codingforums.com/misc.php?do=bbcode) for more.

whizard
01-07-2007, 04:36 AM
Ahh. Thanks!

My world has been improved forever, as I gain another VBulletin ability...

:D

(nothing says nerd like excitement over new Vbulletin abilities....)

:o

Dan

david_kw
01-07-2007, 05:38 AM
Oooh, and I just learned from your link you could have said this



using noparse. That will come in handy trying to explain to people how to post their code without explaining to hit the # button.

Arbitrator
01-07-2007, 05:58 AM
Oooh, and I just learned from your link you could have said this



using noparse. That will come in handy trying to explain to people how to post their code without explaining to hit the # button.Didnít know that.

Unfortunately, it seems partially broken for decimal character references ( ) which still get parsed unless the tags only contain part, but not all, of the reference. Non‐breaking spaces also still get stripped and replaced with normal spaces; thatís rather annoying when I want to prevent line breaks in something like font: oblique bolder small-caps 100px/120px "Lucida Sans Unicode", "Lucida Grande", Tahoma, Geneva, sans-serif.

At least it prevents things like ;) in the previous sentence from being parsed as a graphic. Been wondering how I could get ď:pĒ without the poor image in its place.

_Aerospace_Eng_
01-07-2007, 06:02 AM
Been wondering how I could get ď:pĒ without the poor image in its place.

You simply disable smilies in text. Its under miscellaneous options.

Arbitrator
01-07-2007, 06:16 AM
You simply disable smilies in text. Its under miscellaneous options.Iím aware of that, but the forum removes that option whenever youíre not using either the Enhanced Interface or Standard Editor for posting. I use the Basic Editor; for some reason itís assumed that people that use the Basic Editor are partial toward graphical smilies and will never post code that could be parsed as such. If you want to see it for yourself, go to the Control Panel, Edit Options, and alter the Message Editor Interface under Miscellaneous Options at the bottom.

jayapalchandran
01-07-2007, 11:33 AM
You can create a custom alert box using div, layer and tables.
first you create a HTML view similar to an alert box by using any of dov,layers and tables. make the visibility property to hidden when loading.
using javascript make it visible at which ever position you want... and then one more thing... when a default alert box appears we will be able to do any other event on that page... i hope you get my idea... like that you can do when you show your custom alert box by disabling the mouse and keyboard events like the following...

i have tested this code in Internet explorer


<script>

document.onclick=disableEvents
document.oncontextmenu=disableEvents

var ef=0

function showalert()
{

ef=1
var ids
ids=document.getElementById('alert')
ids.style.left=300;
ids.style.top=150;
ids.style.visibility="visible"
}

function disableEvents()
{
if(ef)
return false;
}
</script>


<body>


<div align=center id="alert" style="position:absolute;left:0;top:0;border: 2px solid gray; width:100; height:100;color:red; background-color:black;visibility:hidden;">

<br>Alert Message <br><br><br>

<input type=button name=ok value=0k onclick="ef=0;document.getElementById('alert').style.visibility='hidden';" >

</div>

<br><br><br>
consider there is some error you want show when this link is clicked
<a href="javascript: showalert();">click here</a>

</body>

note: you may wonder how the ok button is working after disabling the onclick event for the whold document... it is because i think the first priority goes to the ok buttons onclick event only after that documents onclick event is checked...

request: if any one else knows a better solution for the above note please put that to my email jayapalchandran@gmail.com



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum